[postgis-tickets] [PostGIS] #4181: St_AsMVTGeom: Avoid type change due to validation
PostGIS
trac at osgeo.org
Wed Sep 19 06:12:15 PDT 2018
#4181: St_AsMVTGeom: Avoid type change due to validation
------------------------+---------------------------
Reporter: Algunenano | Owner: Algunenano
Type: defect | Status: assigned
Priority: medium | Milestone: PostGIS 2.4.5
Component: postgis | Version: 2.4.x
Keywords: |
------------------------+---------------------------
To comply with MVT spec (2), St_AsMVTGeom forces polygon validation using
`lwgeom_make_valid` and setting the winding order properly.
The problem with this setup is that some polygons, under certain bboxes,
can be transformed to lines during validation:
{{{
SELECT ST_AsEWKT(ST_AsMVTGeom(
'SRID=3857;MULTIPOLYGON(((-8238034.11943289
4970934.90416362,-8238026.20761928 4970930.11708391,-8238049.70095916
4970891.1459086,-8238058.64331211 4970896.5565545,-8238035.14999485
4970935.52777282,-8238034.11943289 4970934.90416362)))'::geometry,
'SRID=3857;POLYGON((-8242969.13027341
4975133.29702555,-8242969.13027341 4970241.3272153,-8238077.16046316
4970241.3272153,-8238077.16046316 4975133.29702555,-8242969.13027341
4975133.29702555))'::geometry,
4096,
16,
true
)) as the_geom_webmercator;
the_geom_webmercator
------------------------------------------------------------------------
SRID=3857;MULTILINESTRING((4112 3546,4112 3547),(4112 3548,4112 3547))
}}}
In this case, after transforming the polygon to MVT coordinates in only
has 3 points left, so make_valid transforms it into 2 lines. I've tried to
encode a similar polygon using Mapnik and it's simply dropped out of the
MVT.
Although this type change isn't against the spec, it causes issues in some
MVT rendereres as they don't expect mixed types or a geometry switching
types depending on the zoom level.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4181>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list