PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_hasNoBand()

Datum RASTER_hasNoBand ( PG_FUNCTION_ARGS  )

Definition at line 554 of file rtpg_raster_properties.c.

555 {
556  rt_pgraster *pgraster = NULL;
557  rt_raster raster = NULL;
558  int bandindex = 0;
559  bool hasnoband = FALSE;
560 
561  /* Deserialize raster */
562  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
563  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
564 
565  raster = rt_raster_deserialize(pgraster, TRUE);
566  if ( ! raster )
567  {
568  ereport(ERROR,
569  (errcode(ERRCODE_OUT_OF_MEMORY),
570  errmsg("RASTER_hasNoBand: Could not deserialize raster")));
571  PG_FREE_IF_COPY(pgraster, 0);
572  PG_RETURN_NULL();
573  }
574 
575  /* Get band number */
576  bandindex = PG_GETARG_INT32(1);
577  hasnoband = !rt_raster_has_band(raster, bandindex - 1);
578 
580  PG_FREE_IF_COPY(pgraster, 0);
581 
582  PG_RETURN_BOOL(hasnoband);
583 }
#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
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_raster.c:1347
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
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_has_band(), and TRUE.

Here is the call graph for this function: