[postgis-tickets] r16558 - ensure that polygons are CW coming out of the ASMVTGEOM process
Paul Ramsey
pramsey at cleverelephant.ca
Mon May 7 11:04:57 PDT 2018
Author: pramsey
Date: 2018-05-07 11:04:57 -0700 (Mon, 07 May 2018)
New Revision: 16558
Modified:
branches/2.4/postgis/mvt.c
Log:
ensure that polygons are CW coming out of the ASMVTGEOM process
Closes #4079
Modified: branches/2.4/postgis/mvt.c
===================================================================
--- branches/2.4/postgis/mvt.c 2018-05-07 17:59:57 UTC (rev 16557)
+++ branches/2.4/postgis/mvt.c 2018-05-07 18:04:57 UTC (rev 16558)
@@ -734,22 +734,27 @@
/* if polygon(s) make valid and force clockwise as per MVT spec */
if (lwgeom_out->type == POLYGONTYPE ||
- lwgeom_out->type == MULTIPOLYGONTYPE) {
- lwgeom_out = lwgeom_make_valid(lwgeom_out);
+ lwgeom_out->type == MULTIPOLYGONTYPE) {
+ lwgeom_out = lwgeom_make_valid(lwgeom_out);
+ /* Because we are in image coordinates, we need to go to CCW in */
+ /* order to get a CW output in image space */
lwgeom_force_clockwise(lwgeom_out);
+ lwgeom_reverse(lwgeom_out);
}
/* if geometry collection extract highest dimensional geometry type */
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 = lwcollection_as_lwgeom(lwcollection_extract(lwcoll, max_type(lwcoll)));
lwgeom_out = lwgeom_homogenize(lwgeom_out);
/* if polygon(s) make valid and force clockwise as per MVT spec */
if (lwgeom_out->type == POLYGONTYPE ||
- lwgeom_out->type == MULTIPOLYGONTYPE) {
- lwgeom_out = lwgeom_make_valid(lwgeom_out);
+ lwgeom_out->type == MULTIPOLYGONTYPE) {
+ lwgeom_out = lwgeom_make_valid(lwgeom_out);
+ /* Because we are in image coordinates, we need to go to CCW in */
+ /* order to get a CW output in image space */
lwgeom_force_clockwise(lwgeom_out);
+ lwgeom_reverse(lwgeom_out);
}
}
More information about the postgis-tickets
mailing list