return NULL;
}
+ /* OGR Geometry is empty */
+ if (OGR_G_IsEmpty(src_geom)) {
+ rtinfo("Geometry provided is empty. Returning empty raster");
+
+ if (noband) {
+ rtdealloc(_pixtype);
+ rtdealloc(_init);
+ rtdealloc(_nodata);
+ rtdealloc(_hasnodata);
+ rtdealloc(_value);
+ }
+
+ OSRDestroySpatialReference(src_sr);
+ /* OGRCleanupAll(); */
+
+ return rt_raster_new(0, 0);
+ }
+
/* get envelope */
OGR_G_GetEnvelope(src_geom, &src_env);
rt_util_from_ogr_envelope(src_env, &extent);
geom = geom2d;
}
+ /* empty geometry, return empty raster */
+ if (lwgeom_is_empty(geom)) {
+ POSTGIS_RT_DEBUG(3, "Input geometry is empty. Returning empty raster");
+ lwgeom_free(geom);
+ PG_FREE_IF_COPY(gser, 0);
+
+ rast = rt_raster_new(0, 0);
+ if (rast == NULL)
+ PG_RETURN_NULL();
+
+ pgrast = rt_raster_serialize(rast);
+ rt_raster_destroy(rast);
+
+ if (NULL == pgrast)
+ PG_RETURN_NULL();
+
+ SET_VARSIZE(pgrast, pgrast->size);
+ PG_RETURN_POINTER(pgrast);
+ }
+
/* scale x */
if (!PG_ARGISNULL(1)) {
scale[0] = PG_GETARG_FLOAT8(1);