[postgis-tickets] r15893 - ST_AsMVTGeom clarification on semantics of mvt_geom

bjorn at wololo.org bjorn at wololo.org
Thu Oct 5 03:50:17 PDT 2017


Author: bjornharrtell
Date: 2017-10-05 03:50:16 -0700 (Thu, 05 Oct 2017)
New Revision: 15893

Modified:
   trunk/postgis/lwgeom_out_mvt.c
   trunk/postgis/mvt.c
Log:
ST_AsMVTGeom clarification on semantics of mvt_geom

Modified: trunk/postgis/lwgeom_out_mvt.c
===================================================================
--- trunk/postgis/lwgeom_out_mvt.c	2017-10-05 10:44:49 UTC (rev 15892)
+++ trunk/postgis/lwgeom_out_mvt.c	2017-10-05 10:50:16 UTC (rev 15893)
@@ -60,11 +60,13 @@
 	extent = PG_ARGISNULL(2) ? 4096 : PG_GETARG_INT32(2);
 	buffer = PG_ARGISNULL(3) ? 256 : PG_GETARG_INT32(3);
 	clip_geom = PG_ARGISNULL(4) ? true : PG_GETARG_BOOL(4);
+	// NOTE: can both return in clone and in place modification so
+	// not known if lwgeom_in can be freed
 	lwgeom_out = mvt_geom(lwgeom_in, bounds, extent, buffer, clip_geom);
-	lwgeom_free(lwgeom_in);
 	if (lwgeom_out == NULL)
 		PG_RETURN_NULL();
 	geom_out = geometry_serialize(lwgeom_out);
+	lwgeom_free(lwgeom_out);
 	PG_FREE_IF_COPY(geom_in, 0);
 	PG_RETURN_POINTER(geom_out);
 #endif

Modified: trunk/postgis/mvt.c
===================================================================
--- trunk/postgis/mvt.c	2017-10-05 10:44:49 UTC (rev 15892)
+++ trunk/postgis/mvt.c	2017-10-05 10:50:16 UTC (rev 15893)
@@ -657,6 +657,8 @@
  *
  * Makes best effort to keep validity. Might collapse geometry into lower
  * dimension.
+ *
+ * NOTE: modifies in place if possible (not currently possible for polygons)
  */
 LWGEOM *mvt_geom(LWGEOM *lwgeom, const GBOX *gbox, uint32_t extent, uint32_t buffer,
 	bool clip_geom)



More information about the postgis-tickets mailing list