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

PostGIS trac at osgeo.org
Fri Mar 21 08:11:25 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:
---------------------------+---------------------------
Description changed by gravitystorm:

Old description:

> Certain functions are not implemented for valid polygons with point
> touching rings (see https://trac.osgeo.org/postgis/ticket/5867).
>
> For some use-cases, it would be handy if there was a function that could
> be used to detect such polygons ahead of time, in order to handle them
> separately. I haven't been able to find any existing postgis function
> that does this, but if I've missed one please let me know.
>
> With such a function, you could choose to ignore these polygons, e.g.
>
> {{{
> select CG_StraightSkeleton(geom)
>   from table
>  where !ST_PolygonHasPointTouchingRing(geom)
> }}}
>
> Alternatively, you could buffer only the geometries that have point
> touching rings, without buffering the vast majority that don't, e.g.
>
> {{{
> select CG_StraightSkeleton(
>        case when ST_PolygonHasPointTouchingRing(geom)
>        then st_buffer(geom, 0.0001)
>        else geom
>        end)
>   from table
> }}}

New description:

 Certain functions are not implemented for valid polygons with point
 touching rings (see https://trac.osgeo.org/postgis/ticket/5867).

 For some use-cases, it would be handy if there was a function that could
 be used to detect such polygons ahead of time, in order to handle them
 separately. I haven't been able to find any existing postgis function that
 does this, but if I've missed one please let me know.

 With such a function, you could choose to ignore these polygons, e.g.

 {{{
 select CG_StraightSkeleton(geom)
   from table
  where !ST_ValidPolygonHasPointTouchingInnerRing(geom)
 }}}

 Alternatively, you could buffer only the geometries that have point
 touching rings, without buffering the vast majority that don't, e.g.

 {{{
 select CG_StraightSkeleton(
        case when ST_ValidPolygonHasPointTouchingInnerRing(geom)
        then st_buffer(geom, 0.0001)
        else geom
        end)
   from table
 }}}

--
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5868#comment:5>
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