#3410 closed defect (fixed)
ST_RemoveRepeatedPoints fails to drop second-to-last point
Reported by: | strk | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.2.1 |
Component: | postgis | Version: | 2.2.x |
Keywords: | Cc: |
Description
A 3-vertices line, in which 2nd and 3rd point are at e-10 distance. Calling ST_RemoveRepeatedPoint with e-8 distance does not remove anything.
Self-contained test:
=# with inp as ( select '010200000003000000BCAABC2B192739418F7DE0E6AB96524185EB51382828394115AE47D12C96524187EB51382828394115AE47D12C965241'::geometry g ) select st_summary(g), st_summary(st_removerepeatedpoints(g,1e-8)), st_distance(st_pointn(g,2), st_pointn(g,3)) from inp; LOG: duration: 0.350 ms statement: with inp as ( select '010200000003000000BCAABC2B192739418F7DE0E6AB96524185EB51382828394115AE47D12C96524187EB51382828394115AE47D12C965241'::geometry g ) select st_summary(g), st_summary(st_removerepeatedpoints(g,1e-8)), st_distance(st_pointn(g,2), st_pointn(g,3)) from inp; -[ RECORD 1 ]---------------------------- st_summary | LineString[B] with 3 points st_summary | LineString[B] with 3 points st_distance | 4.65661287307739e-10
Change History (10)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
I think a simpler implementation would be like the one before r14494 but with an additional check for last-point being unchanged between input and output and moving of the last point if it is not the same.
comment:4 by , 9 years ago
I see one problem is with the "minpoints" parameter. By *forcing* the presence of a minimum of points, what takes precedence between points considered equal and minimum number of points ? It's kind of easy when the minimum number of points is 2, is there any case in which it's bigger than that ?
comment:6 by , 9 years ago
comment:8 by , 9 years ago
Example output:
=# SELECT ST_AsText(ST_RemoveRepeatedPoints('MULTILINESTRING((0 0, 0 0, 0 0, 0 0, 0 0),(0 0,1 0,9 0),(0 0,8 0,9 0))', 2)); st_astext ------------------------------------------------ MULTILINESTRING((0 0,0 0),(0 0,9 0),(0 0,9 0)) (1 row)
comment:9 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Simplified testcase:
I'm finding these cases while trying to fix topological errors as reported in #3402. Removing consecutive nearby points could help there (if it worked)