id summary reporter owner description type status priority milestone component version resolution keywords cc 4181 St_AsMVTGeom: Avoid type change due to validation Algunenano Algunenano "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. " defect closed medium PostGIS 2.4.6 postgis 2.4.x fixed