413{
417 int64_t fileSize;
418 int32_t bandindex;
419
420
421 bandindex = PG_GETARG_INT32(1);
422 if ( bandindex < 1 ) {
423 elog(NOTICE, "Invalid band index (must use 1-based). Returning NULL");
424 PG_RETURN_NULL();
425 }
426
427 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
428 pgraster = (
rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
429
431 if ( ! raster ) {
432 PG_FREE_IF_COPY(pgraster, 0);
433 elog(ERROR, "RASTER_getBandFileTimestamp: Could not deserialize raster");
434 PG_RETURN_NULL();
435 }
436
437
439 if (!band) {
440 elog(
441 NOTICE,
442 "Could not find raster band of index %d when getting band path. Returning NULL",
443 bandindex
444 );
446 PG_FREE_IF_COPY(pgraster, 0);
447 PG_RETURN_NULL();
448 }
449
451 elog(NOTICE, "Band of index %d is not out-db.", bandindex);
454 PG_FREE_IF_COPY(pgraster, 0);
455 PG_RETURN_NULL();
456 }
457
459
462 PG_FREE_IF_COPY(pgraster, 0);
463
464 PG_RETURN_INT64(fileSize);
465}
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
void rt_band_destroy(rt_band band)
Destroy a raster band.
uint64_t rt_band_get_file_timestamp(rt_band band)
Return file timestamp.
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
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): ...