Fork me on GitHub

ST_IsClosed

Signature

BOOLEAN ST_IsClosed(GEOMETRY geom);

Description

Returns TRUE if geom is a closed LINESTRING or MULTILINESTRING, null otherwise. A MULTILINESTRING is closed if all its LINESTRINGs are closed.

Implements the OpenGIS Simple Features Implementation Specification for SQL version 1.2.1.

Examples

SELECT ST_IsClosed('LINESTRING(2 1, 1 3, 5 2)');
-- Answer: FALSE

SELECT ST_IsClosed('LINESTRING(2 1, 1 3, 5 2, 2 1)');
-- Answer: TRUE

SELECT ST_IsClosed('MULTILINESTRING((0 2, 3 2, 3 6, 0 6, 0 1),
                                    (5 0, 7 0, 7 1, 5 1, 5 0))');
-- Answer: FALSE

SELECT ST_IsClosed('MULTILINESTRING((0 2, 3 2, 3 6, 0 6, 0 2),
                                    (5 0, 7 0, 7 1, 5 1, 5 0))');
-- Answer: TRUE
See also