[PostGIS] #5811: Failed Z-axis tolerance in ST_RemoveRepeatedPoints
PostGIS
trac at osgeo.org
Thu Nov 21 17:50:10 PST 2024
#5811: 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 have been using a fuzzer to test PostGIS recently.
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));
}}}
The result is:
{{{
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, and neither point should be deleted.
And the query statement:
{{{
SELECT ST_AsText(ST_RemoveRepeatedPoints('MULTIPOINT(10 10 10, 13 10 10)',
2));
}}}
These two points only differ on the x-axis and are 3,resulting in
{{{
MULTIPOINT Z ((13 10 10),(10 10 10))
}}}
No point was deleted, this is the correct result.
In the official documentation of Postgis, ST_RemoveRepeatedPoints is
stated as a function that supports 3D, but it seems to be invalid for
tolerance on the z-axis.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5811>
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