PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_bandIsNoData()

Datum RASTER_bandIsNoData ( PG_FUNCTION_ARGS  )

Definition at line 240 of file rtpg_band_properties.c.

241 {
242  rt_pgraster *pgraster = NULL;
243  rt_raster raster = NULL;
244  rt_band band = NULL;
245  int32_t bandindex;
246  bool forcechecking = FALSE;
247  bool bandisnodata = FALSE;
248 
249  /* Index is 1-based */
250  bandindex = PG_GETARG_INT32(1);
251  if ( bandindex < 1 ) {
252  elog(NOTICE, "Invalid band index (must use 1-based). Returning NULL");
253  PG_RETURN_NULL();
254  }
255 
256  /* Deserialize raster */
257  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
258  pgraster = (rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
259 
260  raster = rt_raster_deserialize(pgraster, FALSE);
261  if ( ! raster ) {
262  PG_FREE_IF_COPY(pgraster, 0);
263  elog(ERROR, "RASTER_bandIsNoData: Could not deserialize raster");
264  PG_RETURN_NULL();
265  }
266 
267  /* Fetch requested band and its nodata value */
268  band = rt_raster_get_band(raster, bandindex - 1);
269  if ( ! band ) {
270  elog(NOTICE, "Could not find raster band of index %d when determining if band is nodata. Returning NULL", bandindex);
272  PG_FREE_IF_COPY(pgraster, 0);
273  PG_RETURN_NULL();
274  }
275 
276  forcechecking = PG_GETARG_BOOL(2);
277 
278  bandisnodata = (forcechecking) ?
280 
282  PG_FREE_IF_COPY(pgraster, 0);
283 
284  PG_RETURN_BOOL(bandisnodata);
285 }
#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_band_get_isnodata_flag(rt_band band)
Get isnodata flag value.
Definition: rt_band.c:714
int rt_band_check_is_nodata(rt_band band)
Returns TRUE if the band is only nodata values.
Definition: rt_band.c:1752
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
Definition: rt_raster.c:381
band
Definition: ovdump.py:57
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 ovdump::band, FALSE, rtrowdump::raster, rt_band_check_is_nodata(), rt_band_get_isnodata_flag(), rt_raster_deserialize(), rt_raster_destroy(), and rt_raster_get_band().

Here is the call graph for this function: