[PostGIS] #5816: Failed Z-axis tolerance in ST_RemoveRepeatedPoints

PostGIS trac at osgeo.org
Thu Dec 5 17:51:34 PST 2024


#5816: Failed Z-axis tolerance in ST_RemoveRepeatedPoints
---------------------+---------------------------
 Reporter:  nbvfgh   |      Owner:  pramsey
     Type:  defect   |     Status:  new
 Priority:  high     |  Milestone:  PostGIS 3.5.1
Component:  postgis  |    Version:  3.5.x
 Keywords:           |
---------------------+---------------------------
 I used a function called ST_RemoveRepeatedPoint, which takes two
 parameters, a geometry and a floating-point tolerance. When I tried to use
 this function to delete two points that are equal on x and y but not equal
 on the z-axis, a possible logical error occurred:

 ST_RemoveRepeatedPoint(geometry geom, float8 tolerance): Returns a version
 of the given geometry with duplicate consecutive points removed. The
 function processes only (Multi)LineStrings, (Multi)Polygons and
 MultiPoints but it can be called with any kind of geometry.If the
 tolerance parameter is provided, vertices within the tolerance distance of
 one another are considered to be duplicates.

 Query statement:



 {{{
 SELECT ST_AsText(ST_RemoveRepeatedPoints('MULTIPOINT(10 10 10, 10 10 13)',
 2));

 -- expected:{MULTIPOINT Z ((10 10 10), (10 10 13))};
 -- actual:  {MULTIPOINT Z ((10 10 13))};
 }}}



 It is obvious that the difference between the two points in MULTIPOINT (10
 10 10, 10 10 13) on the z-axis is 3(bigger than the tolerance), and the
 point(10, 10, 10)  has still been deleted, which seems to be a bug.



 And the query statement:



 {{{
 SELECT ST_AsText(ST_RemoveRepeatedPoints('MULTIPOINT(10 10 10, 13 10 10)',
 2));

 -- expected:{MULTIPOINT Z ((10 10 10), (13 10 10))};
 -- actual:  {MULTIPOINT Z ((10 10 10), (13 10 10))};

 }}}


 When these two points only differ on the x-axis and are 3(bigger than the
 tolerance),no point was deleted, this is the correct result.

 In the [official
 documentation](https://postgis.net/docs/manual-3.5/ST_RemoveRepeatedPoints.html),
 ST_RemoveRepeatedPoints is stated as a function that supports 3D, but it
 seems to be invalid for tolerance on the z-axis.

 geos version is `GEOS="3.13.0-CAPI-1.19.0"`
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5816>
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