[PostGIS] #5868: Add Function to Detect Valid Polygons with Point Touching Rings

PostGIS trac at osgeo.org
Thu Mar 20 10:09:21 PDT 2025


#5868: Add Function to Detect Valid Polygons with Point Touching Rings
---------------------------+---------------------------
  Reporter:  gravitystorm  |      Owner:  pramsey
      Type:  defect        |     Status:  new
  Priority:  medium        |  Milestone:  PostGIS 3.5.3
 Component:  postgis       |    Version:  3.4.x
Resolution:                |   Keywords:
---------------------------+---------------------------
Comment (by mdavis):

 Can you just use `ST_IsValid`? It will report `false` for self-touching
 rings.

 There is also a flag on `ST_IsValid` which allows polygons with self-
 touching rings to be considered valid.  You could combine this with the
 default `ST_Valid` to test whether a geometry is valid but with a self-
 touch (i.e. to identify geometries to be ignored or fixed):
 {{{
 SELECT (NOT ST_IsValid(geom)) AND ST_IsValid(geom, 1) AS
 is_valid_with_selftouch
 FROM ST_GeomFromText('POLYGON ((5 9, 9 1, 1 1, 5 6, 3 2, 5 2, 5 9))') AS
 t(geom);


 is_valid_with_selftouch
 ---------------------
 t
 }}}
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5868#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list