292{
296 int32_t bandindex;
297 const char *bandpath;
299
300
301 bandindex = PG_GETARG_INT32(1);
302 if ( bandindex < 1 ) {
303 elog(NOTICE, "Invalid band index (must use 1-based). Returning NULL");
304 PG_RETURN_NULL();
305 }
306
307
308 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
309 pgraster = (
rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
310
312 if (!raster) {
313 PG_FREE_IF_COPY(pgraster, 0);
314 elog(ERROR, "RASTER_getBandPath: Could not deserialize raster");
315 PG_RETURN_NULL();
316 }
317
318
320 if (!band) {
321 elog(
322 NOTICE,
323 "Could not find raster band of index %d when getting band path. Returning NULL",
324 bandindex
325 );
327 PG_FREE_IF_COPY(pgraster, 0);
328 PG_RETURN_NULL();
329 }
330
332 if (!bandpath) {
335 PG_FREE_IF_COPY(pgraster, 0);
336 PG_RETURN_NULL();
337 }
338
339 result = cstring_to_text(bandpath);
340
343 PG_FREE_IF_COPY(pgraster, 0);
344
346}
char result[OUT_DOUBLE_BUFFER_SIZE]
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
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_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...