[postgis-tickets] [PostGIS] #4725: ST_MakeValid causes drastic loss of precision

PostGIS trac at osgeo.org
Wed Jul 15 21:48:54 PDT 2020


#4725: ST_MakeValid causes drastic loss of precision
---------------------+---------------------------
 Reporter:  atlight  |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  medium   |  Milestone:  PostGIS 3.0.2
Component:  postgis  |    Version:  2.5.x
 Keywords:           |
---------------------+---------------------------
 ST_MakeValid experiences a drastic loss of precision on a particular
 polygon input. It is a complex polygon with five somewhat pathological
 interior rings.

 The bug only occurs when all five of the interior rings (holes) are
 present. When one is removed, no precision loss occurs.

 What is especially problematic is, when this polygon is part of a
 `MultiPolygon` and ST_MakeValid is applied to the `MultiPolygon`, the
 **entire** `MultiPolygon` loses precision in this manner, rendering the
 geometry useless.

 I've uploaded the WKB of the offending polygon as an attachment. When
 inserted into a table `a` with geometry column `geom`, I get the following
 output:

 {{{
 scratch=# SELECT SUBSTRING(ST_AsText(geom) FROM 1 FOR 100) FROM a;
                                               substring
 ------------------------------------------------------------------------------------------------------
  POLYGON Z ((144.96322622986 -37.741979743636 0,144.96322622986
 -37.741979743636 0,144.963225440888 -
 (1 row)

 scratch=# SELECT SUBSTRING(ST_AsText(ST_MakeValid(geom)) FROM 1 FOR 100)
 FROM a;
                                               substring
 ------------------------------------------------------------------------------------------------------
  GEOMETRYCOLLECTION Z (MULTIPOLYGON Z (((144.963224 -37.74198 0,144.963222
 -37.74198 0,144.963221 -37
 (1 row)
 }}}

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4725>
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