[postgis-tickets] r15384 - ST_AsMVT make sure valid/clockwise even after collection extraction

bjorn at wololo.org bjorn at wololo.org
Wed May 3 06:38:11 PDT 2017


Author: bjornharrtell
Date: 2017-05-03 06:38:11 -0700 (Wed, 03 May 2017)
New Revision: 15384

Modified:
   trunk/postgis/mvt.c
   trunk/regress/mvt_expected
Log:
ST_AsMVT make sure valid/clockwise even after collection extraction

Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c	2017-05-03 03:50:38 UTC (rev 15383)
+++ trunk/postgis/mvt.c	2017-05-03 13:38:11 UTC (rev 15384)
@@ -554,15 +554,16 @@
 	if (lwgeom_out == NULL || lwgeom_is_empty(lwgeom_out))
 		return NULL;
 
+	lwgeom_out = lwgeom_make_valid(lwgeom_out);
 	lwgeom_force_clockwise(lwgeom_out);
-	lwgeom_out = lwgeom_make_valid(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))

Modified: trunk/regress/mvt_expected
===================================================================
--- trunk/regress/mvt_expected	2017-05-03 03:50:38 UTC (rev 15383)
+++ trunk/regress/mvt_expected	2017-05-03 13:38:11 UTC (rev 15384)
@@ -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==



More information about the postgis-tickets mailing list