]> granicus.if.org Git - postgis/commitdiff
ST_AsMVTGeom clarification on semantics of mvt_geom
authorBjörn Harrtell <bjorn@wololo.org>
Thu, 5 Oct 2017 10:50:16 +0000 (10:50 +0000)
committerBjörn Harrtell <bjorn@wololo.org>
Thu, 5 Oct 2017 10:50:16 +0000 (10:50 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@15893 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/lwgeom_out_mvt.c
postgis/mvt.c

index d3a0b73001634e6e6ef6567f7f6ef19bb5d00d4c..8dacd2d2dc700fbabd6d018dfbf4c47b1b5a26c5 100644 (file)
@@ -60,11 +60,13 @@ Datum ST_AsMVTGeom(PG_FUNCTION_ARGS)
        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
index 018096912994eff92456399b94121b89289b1240..6f69b0e78b8a02cf93cc24b1807aa1d20d634f9e 100644 (file)
@@ -657,6 +657,8 @@ static int max_type(LWCOLLECTION *lwcoll)
  *
  * 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)