| | |
| | | /* specify SRID */ |
| | | lwgeom_set_srid(mpoly, rt_raster_get_srid(raster)); |
| | | |
| | | /*#<<<DIA_SVACE_MAJOR*/ |
| | | /* convert to multi */ |
| | | if (!lwgeom_is_collection(mpoly)) { |
| | | tmp = mpoly; |
| | | |
| | | #if POSTGIS_DEBUG_LEVEL > 3 |
| | | { |
| | | char *wkt = lwgeom_to_wkt(mpoly, WKT_ISO, DBL_DIG, NULL); |
| | | RASTER_DEBUGF(4, "before multi = %s", wkt); |
| | | rtdealloc(wkt); |
| | | } |
| | | { |
| | | char *wkt = lwgeom_to_wkt(mpoly, WKT_ISO, DBL_DIG, NULL); |
| | | RASTER_DEBUGF(4, "before multi = %s", wkt); |
| | | rtdealloc(wkt); |
| | | } |
| | | #endif |
| | | |
| | | RASTER_DEBUGF(4, "mpoly @ %p", mpoly); |
| | | RASTER_DEBUGF(4, "mpoly @ %p", mpoly); |
| | | |
| | | /* |
| | | lwgeom_as_multi() only does a shallow clone internally |
| | | so input and output geometries may share memory |
| | | hence the deep clone of the output geometry for returning |
| | | is the only way to guarantee the memory isn't shared |
| | | */ |
| | | mpoly = lwgeom_as_multi(tmp); |
| | | clone = lwgeom_clone_deep(mpoly); |
| | | lwgeom_free(tmp); |
| | | lwgeom_free(mpoly); |
| | | mpoly = clone; |
| | | /* |
| | | lwgeom_as_multi() only does a shallow clone internally |
| | | so input and output geometries may share memory |
| | | hence the deep clone of the output geometry for returning |
| | | is the only way to guarantee the memory isn't shared |
| | | */ |
| | | mpoly = lwgeom_as_multi(tmp); |
| | | clone = lwgeom_clone_deep(mpoly); |
| | | lwgeom_free(tmp); |
| | | lwgeom_free(mpoly); |
| | | mpoly = clone; |
| | | |
| | | RASTER_DEBUGF(4, "mpoly @ %p", mpoly); |
| | | RASTER_DEBUGF(4, "mpoly @ %p", mpoly); |
| | | |
| | | #if POSTGIS_DEBUG_LEVEL > 3 |
| | | { |
| | | char *wkt = lwgeom_to_wkt(mpoly, WKT_ISO, DBL_DIG, NULL); |
| | | RASTER_DEBUGF(4, "after multi = %s", wkt); |
| | | rtdealloc(wkt); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | #if POSTGIS_DEBUG_LEVEL > 3 |
| | | { |
| | | char *wkt = lwgeom_to_wkt(mpoly, WKT_ISO, DBL_DIG, NULL); |
| | | RASTER_DEBUGF(4, "after multi = %s", wkt); |
| | | RASTER_DEBUGF(4, "returning geometry = %s", wkt); |
| | | rtdealloc(wkt); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | #if POSTGIS_DEBUG_LEVEL > 3 |
| | | { |
| | | char *wkt = lwgeom_to_wkt(mpoly, WKT_ISO, DBL_DIG, NULL); |
| | | RASTER_DEBUGF(4, "returning geometry = %s", wkt); |
| | | rtdealloc(wkt); |
| | | } |
| | | #endif |
| | | *surface = lwgeom_as_lwmpoly(mpoly); |
| | | return ES_NONE; |
| | | /*#DIA_SVACE_MAJOR>>>*/ |
| | | |
| | | *surface = lwgeom_as_lwmpoly(mpoly); |
| | | return ES_NONE; |
| | | } |
| | | |