PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_hasNoBand ( PG_FUNCTION_ARGS  )

Definition at line 6731 of file rt_pg.c.

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

6732 {
6733  rt_pgraster *pgraster = NULL;
6734  rt_raster raster = NULL;
6735  int bandindex = 0;
6736  bool hasnoband = FALSE;
6737 
6738  /* Deserialize raster */
6739  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
6740  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
6741 
6742  raster = rt_raster_deserialize(pgraster, TRUE);
6743  if ( ! raster )
6744  {
6745  ereport(ERROR,
6746  (errcode(ERRCODE_OUT_OF_MEMORY),
6747  errmsg("RASTER_hasNoBand: Could not deserialize raster")));
6748  PG_FREE_IF_COPY(pgraster, 0);
6749  PG_RETURN_NULL();
6750  }
6751 
6752  /* Get band number */
6753  bandindex = PG_GETARG_INT32(1);
6754  hasnoband = !rt_raster_has_band(raster, bandindex - 1);
6755 
6756  rt_raster_destroy(raster);
6757  PG_FREE_IF_COPY(pgraster, 0);
6758 
6759  PG_RETURN_BOOL(hasnoband);
6760 }
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
int rt_raster_has_band(rt_raster raster, int nband)
Return TRUE if the raster has a band of this number.
Definition: rt_api.c:8563
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
#define FALSE
Definition: dbfopen.c:169
Struct definitions.
Definition: rt_api.h:2175
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350
#define TRUE
Definition: dbfopen.c:170

Here is the call graph for this function: