PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ RASTER_hasNoBand()

Datum RASTER_hasNoBand ( PG_FUNCTION_ARGS  )

Definition at line 551 of file rtpg_raster_properties.c.

References FALSE, PG_FUNCTION_INFO_V1(), rtrowdump::raster, RASTER_metadata(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_has_band(), and TRUE.

Referenced by RASTER_isEmpty().

552 {
553  rt_pgraster *pgraster = NULL;
554  rt_raster raster = NULL;
555  int bandindex = 0;
556  bool hasnoband = FALSE;
557 
558  /* Deserialize raster */
559  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
560  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
561 
562  raster = rt_raster_deserialize(pgraster, TRUE);
563  if ( ! raster )
564  {
565  ereport(ERROR,
566  (errcode(ERRCODE_OUT_OF_MEMORY),
567  errmsg("RASTER_hasNoBand: Could not deserialize raster")));
568  PG_FREE_IF_COPY(pgraster, 0);
569  PG_RETURN_NULL();
570  }
571 
572  /* Get band number */
573  bandindex = PG_GETARG_INT32(1);
574  hasnoband = !rt_raster_has_band(raster, bandindex - 1);
575 
576  rt_raster_destroy(raster);
577  PG_FREE_IF_COPY(pgraster, 0);
578 
579  PG_RETURN_BOOL(hasnoband);
580 }
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_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_raster.c:1351
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:
Here is the caller graph for this function: