[PostGIS] #6008: Add a Variant of ST_Polygon(raster) with Guaranteed Valid Geometry Output

PostGIS trac at osgeo.org
Tue Oct 21 08:48:30 PDT 2025


#6008: Add a Variant of ST_Polygon(raster) with Guaranteed Valid Geometry Output
-------------------------------------------------+-------------------------
 Reporter:  GISuser5432                          |      Owner:  robe
     Type:  task                                 |     Status:  new
 Priority:  high                                 |  Milestone:  PostGIS
                                                 |  3.6.1
Component:  raster                               |    Version:  3.6.x
 Keywords:  PostGIS_Raster; ST_Polygon(rast);    |
  Valid Geometry;                                |
-------------------------------------------------+-------------------------
 I am upgrading an old project that uses ST_Polygon(raster)
 [https://postgis.net/docs/RT_ST_Polygon.html] in a production environment.

 While preparing to upgrade PostGIS to the latest version, I noticed that
 starting from version **3.3.0**, the function no longer **checks the
 validity** of the output geometry to improve performance.

 Although this optimization makes sense for speed, there are use cases
 where **100% valid output is critical**. Handling invalid geometries case
 by case in production can be error-prone.


 **Proposal:**
 Add an optional argument to ST_Polygon(raster) that allows users to choose
 between:

 *    Fast mode (current behavior, no validity check)
 *    Robust mode (guarantees valid geometry output)

 I am not certain whether passing the result through ST_MakeValid(geom) is
 always sufficient, or if invalid geometries can still occur.

 A variant or option that guarantees validity would be extremely valuable
 for production environments.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6008>
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