From: Björn Harrtell Date: Wed, 3 May 2017 13:38:11 +0000 (+0000) Subject: ST_AsMVT make sure valid/clockwise even after collection extraction X-Git-Tag: 2.4.0alpha~109 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2e016011fb95d9e6c551d59523d80fb2caca7c7b;p=postgis ST_AsMVT make sure valid/clockwise even after collection extraction git-svn-id: http://svn.osgeo.org/postgis/trunk@15384 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/mvt.c b/postgis/mvt.c index 5544aaed3..9758dfec5 100644 --- a/postgis/mvt.c +++ b/postgis/mvt.c @@ -554,15 +554,16 @@ LWGEOM *mvt_geom(LWGEOM *lwgeom, GBOX *gbox, uint32_t extent, uint32_t buffer, if (lwgeom_out == NULL || lwgeom_is_empty(lwgeom_out)) return NULL; - lwgeom_force_clockwise(lwgeom_out); lwgeom_out = lwgeom_make_valid(lwgeom_out); + lwgeom_force_clockwise(lwgeom_out); if (lwgeom_out->type == COLLECTIONTYPE) { LWCOLLECTION *lwcoll = lwgeom_as_lwcollection(lwgeom_out); lwgeom_out = lwcollection_as_lwgeom( lwcollection_extract(lwcoll, max_type(lwcoll))); lwgeom_out = lwgeom_homogenize(lwgeom_out); - // TODO: might not be valid here... may want to union? + lwgeom_out = lwgeom_make_valid(lwgeom_out); + lwgeom_force_clockwise(lwgeom_out); } if (lwgeom_out == NULL || lwgeom_is_empty(lwgeom_out)) diff --git a/regress/mvt_expected b/regress/mvt_expected index 50f1163ff..b78f18d6e 100644 --- a/regress/mvt_expected +++ b/regress/mvt_expected @@ -1,11 +1,11 @@ PG1|POINT(1 4094) PG2|POINT(0 4095) PG3|POINT(2 4092) -PG4|MULTIPOLYGON(((5 4096,10 4096,10 4091,5 4096)),((0 4096,0 4101,5 4096,0 4096))) +PG4|MULTIPOLYGON(((5 4096,10 4096,10 4091,5 4096)),((5 4096,0 4096,0 4101,5 4096))) PG5| PG6|POLYGON((894 2704,2791 594,600 594,894 2704)) -PG7|POLYGON((1252 1904,1251 1904,1252 1905,1253 1906,1253 1905,1252 1904)) -PG8|MULTIPOLYGON(((5 4096,10 4096,10 4091,5 4096)),((0 4096,0 4101,5 4096,0 4096))) +PG7|POLYGON((1251 1904,1252 1905,1253 1906,1253 1905,1252 1904,1251 1904)) +PG8|MULTIPOLYGON(((5 4096,10 4096,10 4091,5 4096)),((5 4096,0 4096,0 4101,5 4096))) PG9|POLYGON((0 4096,4096 4096,4096 0,0 0,0 4096)) TG1|GiEKBHRlc3QSDBICAAAYASIECTLePxoCYzEiAigBKIAgeAI= TG2|GiMKBHRlc3QSDhICAAAYASIGETLePwIBGgJjMSICKAEogCB4Ag==