Opened 6 years ago

Closed 6 years ago

#4184 closed defect (invalid)

Completely different geometry after St_MakeValid

Reported by: Algunenano Owned by: Algunenano
Priority: medium Milestone: PostGIS 2.4.6
Component: postgis Version: 2.4.x
Keywords: Cc:

Description

I start with the following geometry from the NYC mnmappluto dataset:

SRID=3857;MULTIPOLYGON(((-8231365.02893734 4980355.83678553,-8231366.94866817 4980350.2976052,-8231368.82883367 4980344.52250402,-8231370.96255986 4980333.47364302,-8231372.09200747 4980327.69798564,-8231372.84505222 4980323.68014243,-8231374.2255656 4980316.77455645,-8231375.10554947 4980309.86865218,-8231380.6311111 4980275.9676398,-8231394.82332406 4980186.31880185,-8231394.8569833 4980133.57928934,-8231367.43081065 4979982.17443372,-8231372.85765532 4979985.17751813,-8231395.25669799 4980132.93828551,-8231396.69199339 4980227.59327083,-8231377.30092207 4980340.77515211,-8231368.35061694 4980357.62467295,-8231365.02893734 4980355.83678553)))

As when I simplify the geometry for rendering it ends up being invalid I force validation with St_MakeValid:

Select St_AsEWKT(St_MakeValid(ST_Simplify(ST_RemoveRepeatedPoints('SRID=3857;MULTIPOLYGON(((-8231365.02893734 4980355.83678553,-8231366.94866817 4980350.2976052,-8231368.82883367 4980344.52250402,-8231370.96255986 4980333.47364302,-8231372.09200747 4980327.69798564,-8231372.84505222 4980323.68014243,-8231374.2255656 4980316.77455645,-8231375.10554947 4980309.86865218,-8231380.6311111 4980275.9676398,-8231394.82332406 4980186.31880185,-8231394.8569833 4980133.57928934,-8231367.43081065 4979982.17443372,-8231372.85765532 4979985.17751813,-8231395.25669799 4980132.93828551,-8231396.69199339 4980227.59327083,-8231377.30092207 4980340.77515211,-8231368.35061694 4980357.62467295,-8231365.02893734 4980355.83678553)))'::geometry, 19.109257221221924), 19.109257221221924, true)));

The end result is nowhere near the original input: https://user-images.githubusercontent.com/664253/45769751-d27aeb80-bc40-11e8-9c12-dd63e202b0df.png

In purple the original geometry, in orange (and much bigger than the screenshot) the final geometry.

Change History (2)

comment:1 by dbaston, 6 years ago

Behaviour of ST_MakeValid looks OK to me here. The "nowhere near the original input" is a consequence of ST_Simplify, no ?

comment:2 by Algunenano, 6 years ago

Resolution: invalid
Status: assignedclosed

The issue came from me copying and pasting from psql without fixing the carriage returns in the geometry text. When fixed it shows as expected.

Note: See TracTickets for help on using tickets.