PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum RASTER_getNumBands ( PG_FUNCTION_ARGS  )

Definition at line 166 of file rtpg_raster_properties.c.

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

167 {
168  rt_pgraster *pgraster;
170  int32_t num_bands;
171 
172  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
173  pgraster = (rt_pgraster *) PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
174 
175  raster = rt_raster_deserialize(pgraster, TRUE);
176  if ( ! raster ) {
177  PG_FREE_IF_COPY(pgraster, 0);
178  elog(ERROR, "RASTER_getNumBands: Could not deserialize raster");
179  PG_RETURN_NULL();
180  }
181 
182  num_bands = rt_raster_get_num_bands(raster);
183 
184  rt_raster_destroy(raster);
185  PG_FREE_IF_COPY(pgraster, 0);
186 
187  PG_RETURN_INT32(num_bands);
188 }
uint16_t rt_raster_get_num_bands(rt_raster raster)
Definition: rt_raster.c:372
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
Struct definitions.
Definition: librtcore.h:2201
#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: