PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum RASTER_isEmpty ( PG_FUNCTION_ARGS  )

Definition at line 519 of file rtpg_raster_properties.c.

References FALSE, rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), rt_raster_is_empty(), and TRUE.

520 {
521  rt_pgraster *pgraster = NULL;
522  rt_raster raster = NULL;
523  bool isempty = FALSE;
524 
525  /* Deserialize raster */
526  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
527  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
528 
529  raster = rt_raster_deserialize(pgraster, TRUE);
530  if ( ! raster )
531  {
532  ereport(ERROR,
533  (errcode(ERRCODE_OUT_OF_MEMORY),
534  errmsg("RASTER_isEmpty: Could not deserialize raster")));
535  PG_FREE_IF_COPY(pgraster, 0);
536  PG_RETURN_NULL();
537  }
538 
539  isempty = rt_raster_is_empty(raster);
540 
541  rt_raster_destroy(raster);
542  PG_FREE_IF_COPY(pgraster, 0);
543 
544  PG_RETURN_BOOL(isempty);
545 }
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
int rt_raster_is_empty(rt_raster raster)
Return TRUE if the raster is empty.
Definition: rt_raster.c:1338
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
#define FALSE
Definition: dbfopen.c:168
Struct definitions.
Definition: librtcore.h:2213
#define TRUE
Definition: dbfopen.c:169
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:717

Here is the call graph for this function: