]> granicus.if.org Git - postgis/commitdiff
ST_AsMVT make sure valid/clockwise even after collection extraction
authorBjörn Harrtell <bjorn@wololo.org>
Wed, 3 May 2017 13:38:11 +0000 (13:38 +0000)
committerBjörn Harrtell <bjorn@wololo.org>
Wed, 3 May 2017 13:38:11 +0000 (13:38 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15384 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/mvt.c
regress/mvt_expected

index 5544aaed36263331418fa30457a82c2c1d077a44..9758dfec5cdf37b38a4967a0a206ced05af87579 100644 (file)
@@ -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))
index 50f1163fff4fdc7af61c5742d13a190996b7af99..b78f18d6e84ae231f8000d548b1d6135575e1919 100644 (file)
@@ -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==