Opened 6 years ago
Closed 6 years ago
#4161 closed enhancement (fixed)
St_AsMVTGeom: Shortcut geometries smaller than the tolerance
Reported by: | Algunenano | Owned by: | Algunenano |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.0.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
St_AsMVTGeom drops geometries when they get too small after snapping them to the final grid. With this PR we now try to drop those geometries right away so they don't have to go through lwgeom_remove_repeated_points_in_place + lwgeom_simplify_in_place + lwgeom_clip_by_rect + lwgeom_affine + lwgeom_grid_in_place unnecessarily.
This doesn't have any noticeable performance impact in point datasets or when the geometries are bigger* than the tolerance ( < ±5% performance difference testing whole tile generation), but it's a nice improvement for low zoom tiles (bigger tolerance, more geometries dropped), almost halving some of the timings.
*Bigger as in, it's bounding box max size is bigger than the tolerance, which is set to ½ * tile_size / tile_extent.
This PR also means a small additional change that can be considered both a drawback or an improvement: Due to how the simplification functions work, some super small geometries could go through the simplification process if they were between grid borders; so for a set of geometries with the same shape and size, some might appear and some don't depending on their position in the grid. With this PR this should be more consistent.
In 16711: