Skip to content

ST_IsClosed

Returns true if the LINESTRING start and end point are the same.

Usage

boolean ST_IsClosed(geom: geometry)
boolean ST_IsClosed(geog: geography)

Arguments

  • geog (geography): Input geography
  • geom (geometry): Input geometry

Description

Returns true if the LineString’s start and end points are the same. For MultiLineStrings, all elements must be closed.

Examples

SELECT ST_IsClosed(ST_GeomFromText('LINESTRING(0 0, 1 1, 1 0, 0 0)'));
┌──────────────────────────────────────────────────────────────────────┐
│ st_isclosed(st_geomfromtext(Utf8("LINESTRING(0 0, 1 1, 1 0, 0 0)"))) │
│                                boolean                               │
╞══════════════════════════════════════════════════════════════════════╡
│ true                                                                 │
└──────────────────────────────────────────────────────────────────────┘
SELECT ST_IsClosed(ST_GeogFromWKT('LINESTRING(0 0, 1 1, 1 0, 0 0)'));
┌─────────────────────────────────────────────────────────────────────┐
│ st_isclosed(st_geogfromwkt(Utf8("LINESTRING(0 0, 1 1, 1 0, 0 0)"))) │
│                               boolean                               │
╞═════════════════════════════════════════════════════════════════════╡
│ true                                                                │
└─────────────────────────────────────────────────────────────────────┘