PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_isEmpty()

Datum RASTER_isEmpty ( PG_FUNCTION_ARGS  )

Definition at line 522 of file rtpg_raster_properties.c.

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

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

Here is the call graph for this function: