#4149 closed enhancement (fixed)
MVT: Be able to tweak simplification in St_AsMVTGeom
Reported by: | Algunenano | Owned by: | Algunenano |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.2.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
In some situations you want a big extent (e.g. 4096) to represent the geometries in a MVT with precision for the current zoom and, until the request arrives, to temporarily render the next zoom level too, but you don't want the big tile size that having the geometry ready for 4 zoom levels implies since you aren't skipping zoom levels (a.k.a. overzooming).
For those cases it's interesting to have the possibility of simplifying the geometry for a zoom level but keep the main extent to a higher precision. For example, if you use a 4096 extent for the layer and 512 for simplification, any points falling inside the same 512 grid can be considered duplicated, but the final points keep the 4096 precision.
For these use cases what I'm currently doing is simplifying (ST_Simplify(ST_RemoveRepeatedPoints(${geomColumn}, ${tol}), ${tol}, true
)) the geometry before entering St_AsMVTGeom. This works but it means that there are 2 simplification processes going on, the external and the (now unnecessary) internal.
I see 2 valid options to handle this:
- Add the simplify_extent option to St_AsMVTGeom so the simplification process and the final snapping can be detached. This would probably be the option with the best performance.
- Add the option of disabling the simplification process in St_AsMVTGeom and keep only the external simplification. This is the most future safe option: if you can disable simplification and add you own, you are able not only to change tolerance levels but also change simplification functions (ST_SimplifyPreserveTopology instead of St_Simplify for example).
There is also the option of adding some kind of hook to the St_AsMVTGeom to set the simplification functions on the fly, but I feel that that's just too much complexity.
Change History (11)
comment:1 by , 5 years ago
comment:2 by , 5 years ago
I would ask to remove the simplification. Current one breaks overzoom: https://matrix.org/_matrix/media/v1/download/matrix.org/CtmGOQsiGuKmeHUvnwhYSZNF
comment:3 by , 5 years ago
After giving it some thought: it may be feasible to leave the internal simplification with threshold of 0. This way it will remove points that happen to be really colinear after grid snapping, but not introduce any change into their topological relation compared to what it was before grid snapping.
comment:5 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
Based on review in PR, closing this out.
comment:7 by , 5 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
comment:8 by , 5 years ago
Milestone: | PostGIS 3.0.0 → PostGIS 3.1.0 |
---|
comment:9 by , 4 years ago
Milestone: | PostGIS 3.1.0 → PostGIS Fund Me |
---|
comment:11 by , 3 years ago
Milestone: | PostGIS Fund Me → PostGIS 3.2.0 |
---|
I want to add something extra here, which is that now with wagyu depending on the size of the polygon and tolerance used, simplifying the geometries might be slower that not doing it, so the solution could end up being removing the simplification completely. Needs further performance testing.