Commit e5c92b18 authored by Raúl Marín's avatar Raúl Marín

MVT: Drop geometries smaller than the resolution

Closes #4161
Closes https://github.com/postgis/postgis/pull/288



git-svn-id: http://svn.osgeo.org/postgis/trunk@16711 b70326c6-7e19-0410-871a-916f4a2858ee
parent ae6f8ec3
Pipeline #28954166 passed with stage
in 24 minutes and 54 seconds
......@@ -6,6 +6,7 @@ PostGIS 3.0.0
- #4162, ST_DWithin documentation examples for storing geometry and
radius in table (Darafei Praliaskouski, github user Boscop).
- #4163, MVT: Fix resource leak when the first geometry is NULL (Raúl Marín)
- #4161, MVT: Drop geometries smaller than the resolution (Raúl Marín)
PostGIS 2.5.0rc1
2018/08/19
......
......@@ -794,6 +794,17 @@ LWGEOM *mvt_geom(LWGEOM *lwgeom, const GBOX *gbox, uint32_t extent, uint32_t buf
fx = extent / width;
fy = -(extent / height);
if (FLAGS_GET_BBOX(lwgeom->flags) && lwgeom->bbox &&
(lwgeom->type == LINETYPE || lwgeom->type == MULTILINETYPE ||
lwgeom->type == POLYGONTYPE || lwgeom->type == MULTIPOLYGONTYPE))
{
// Shortcut to drop geometries smaller than the resolution
double bbox_width = lwgeom->bbox->xmax - lwgeom->bbox->xmin;
double bbox_height = lwgeom->bbox->ymax - lwgeom->bbox->ymin;
if (bbox_height * bbox_height + bbox_width * bbox_width < res * res)
return NULL;
}
/* Remove all non-essential points (under the output resolution) */
lwgeom_remove_repeated_points_in_place(lwgeom, res);
lwgeom_simplify_in_place(lwgeom, res, preserve_collapsed);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment