Opened 5 years ago
Closed 5 years ago
#4556 closed defect (fixed)
st_asmvtgeom sometimes produces leaking polygons (wagyu)
Reported by: | anneb | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.0.1 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
st_AsMVTgeom in postgis 3.0 built with wagyu 0.43 sometimes produces leaking polygons.
if a polygon is the surface of a circular road, the output polygon of st_asmvtgeom sometimes changes to a filled circle at lower (zoomed-out) zoom levels.
I am attaching an example. Unfortunately I did not yet succeed to reduce the problem to a small data example.
Attachments (3)
Change History (8)
by , 5 years ago
Attachment: | asmvtgeom_leak.sql added |
---|
by , 5 years ago
Attachment: | mvt_default.png added |
---|
by , 5 years ago
Attachment: | mvt_nosimplification.png added |
---|
comment:1 by , 5 years ago
comment:2 by , 5 years ago
I believe just commenting out line:
lwgeom_simplify_in_place(lwgeom, res, preserve_collapsed);
is enough to solve the problem.
After rebuilding, I tried this and several previous problematic polygons and they are now all output correctly.
Commenting out only line
lwgeom_remove_repeated_points_in_place
does not solve the polygon-leak problem.
comment:3 by , 5 years ago
I believe just commenting out line: lwgeom_simplify_in_place(lwgeom, res, preserve_collapsed); is enough to solve the problem.
Thanks.
We rely on this step for 2 things:
- Remove unnecessary points in some scenarios (for example if you have a straight horizontal line (0 0, 0 1, 0 4, 0 10) it'd be transformed into (0 0, 0 10)).
- For big lines / polygons there are some cases where it's faster to simplify the polygon first before doing the transformation, because the amount of point removed is important. This was true almost always with the GEOS backend, but it isn't anymore.
The ideal situation would be to not need these calls (simplify, removeRepeatedPoints) at all but I'd need to look into it in more detail and see if we can keep the same performance and behaviour without them.
comment:4 by , 5 years ago
Milestone: | PostGIS 3.0.0 → PostGIS 3.0.1 |
---|---|
Summary: | st_asmvtgeom sometimes produces leaking polygons (postgis 3.0) → st_asmvtgeom sometimes produces leaking polygons (wagyu) |
Version: | → trunk |
It seems this happens because the polygon becomes invalid after the calls to simplify it:
Before doing anything the polygon is valid, and if I remove these lines the output is correct (see mvt_default.png vs mvt_nosimplification.png).
Maybe it's time to revisit https://trac.osgeo.org/postgis/ticket/4149 and maybe remove the simplification step for wagyu at least.