290 const char *bandpath;
294 bandindex = PG_GETARG_INT32(1);
295 if ( bandindex < 1 ) {
296 elog(NOTICE,
"Invalid band index (must use 1-based). Returning NULL");
301 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
302 pgraster = (
rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
306 PG_FREE_IF_COPY(pgraster, 0);
307 elog(ERROR,
"RASTER_getBandPath: Could not deserialize raster");
316 "Could not find raster band of index %d when getting band path. Returning NULL",
320 PG_FREE_IF_COPY(pgraster, 0);
328 PG_FREE_IF_COPY(pgraster, 0);
332 result = (text *) palloc(VARHDRSZ + strlen(bandpath) + 1);
333 SET_VARSIZE(result, VARHDRSZ + strlen(bandpath) + 1);
334 strcpy((
char *) VARDATA(result), bandpath);
338 PG_FREE_IF_COPY(pgraster, 0);
340 PG_RETURN_TEXT_P(result);
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
void rt_band_destroy(rt_band band)
Destroy a raster band.
const char * rt_band_get_ext_path(rt_band band)
Return band's external path (only valid when rt_band_is_offline returns non-zero).
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.