[postgis-tickets] [PostGIS] #4181: St_AsMVTGeom: Avoid type change due to validation
PostGIS
trac at osgeo.org
Tue Oct 2 07:39:13 PDT 2018
#4181: St_AsMVTGeom: Avoid type change due to validation
-------------------------+---------------------------
Reporter: Algunenano | Owner: Algunenano
Type: defect | Status: reopened
Priority: medium | Milestone: PostGIS 2.4.6
Component: postgis | Version: 2.4.x
Resolution: | Keywords:
-------------------------+---------------------------
Comment (by Algunenano):
The steps taken for that geometry:
* INPUT: A valid multipolygon made of 2 polygons:
`SRID=3857;MULTIPOLYGON(((-8230324.85568 4984496.35686,-8230307.11142
4984654.46474,-8230285.21086 4984959.6035,-8230324.85568
4984496.35686)),((-8230327.54014 4984444.33052,-8230327.23971
4984450.39402,-8230327.26833 4984449.87732,-8230327.54014
4984444.33052)))`
* After the simplification step it stays the same (it was already
simplified).
* Clipping wasn't necessary, so it also stays the same.
* After snapping it to the MVT grid we have 2 polygons, with the second
one being invalid:
`SRID=3857;MULTIPOLYGON(((3245 2224,3253 2158,3262 2030,3245 2224)),((3244
2246,3244 2243,3244 2244,3244 2246)))`
* After validation we have a geometry collection formed by 1 polygon and a
multistring made of 2 lines:
`+ SRID=3857;GEOMETRYCOLLECTION(POLYGON((3245 2224,3262 2030,3253
2158,3245 2224)),MULTILINESTRING((3244 2244,3244 2246),(3244 2243,3244
2244)))`
* Since MVT is incompatible with collections types, mvt_geom drops the
geometry with the smallest geometry type:
`SRID=3857;MULTILINESTRING((3244 2244,3244 2246),(3244 2243,3244 2244))`
I intend to fix it by saving the initial type and preferring something
equivalent when extracting the basic type at the last step.
For reference, what Mapnik does for geometry collections is to duplicate
the features (one feature per each geometry in the collection), but this
also has some drawbacks like duplicating what should be unique values.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4181#comment:7>
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