ST_IsClosed — Tests if a LineString is closed.
boolean ST_IsClosed(bytea
LineString);
Tests if a LineString is closed. Returns TRUE if the LineString is closed (StartPoint and EndPoint are the same Point). Returns Null if the incoming geometry is not a LineString or a MultiLineString.
| 2D | 3D | M |
|---|---|---|
![]() | - | - |
| OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
|---|---|---|---|
| 2.1.5.1 | 7.2.12.1 | 7.2.17.2 | 7.1.5 , 9.3.3 |
SELECT ST_IsClosed(ST_GeomFromText('LINESTRING (0 0, 10 20, 30 20)'));
--Result
FALSE
SELECT ST_IsClosed(ST_GeomFromText('LINESTRING (0 0, 10 20, 30 20,0 0)'));
--Result
TRUE
SELECT ST_IsClosed(ST_GeomFromText('MULTILINESTRING ((0 0, 10 20, 30 20, 0 0), (100 100, 110 120, 130 120, 108 100))'));
--Result
FALSE
SELECT ST_IsClosed(ST_GeomFromText('POINT(0 0)'));
--Result
null