This topic describes the ST_IsRing function. This function returns true if the results of both the ST_IsClosed function and the ST_IsSimple function for the input geometry object are true.

Syntax

boolean  ST_IsRing(geometry  g);

Parameters

Parameter Description
g The geometry object that you want to specify.

Examples

  • If you execute the following statement, the function returns true:
    SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom) FROM (SELECT 'LINESTRING(0 0,0 2,2 0,0 0)'::geometry AS geom) AS test;
     st_isring | st_isclosed | st_issimple
    -----------+-------------+-------------
     t         | t           | t
    (1 row)
                        
  • If you execute the following statement, the function returns false:
    SELECT ST_IsRing(geom), ST_IsClosed(geom), ST_IsSimple(geom) FROM (SELECT 'LINESTRING(0 0,0 2,0 0)'::geometry AS geom) AS test;
     st_isring | st_isclosed | st_issimple
    -----------+-------------+-------------
     f         | t           | f
    (1 row)