129 const size_t name_size = 8;
135 if (PG_ARGISNULL(0)) PG_RETURN_NULL();
136 pgraster = (
rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
139 bandindex = PG_GETARG_INT32(1);
140 if ( bandindex < 1 ) {
141 elog(NOTICE,
"Invalid band index (must use 1-based). Returning NULL");
142 PG_FREE_IF_COPY(pgraster, 0);
148 PG_FREE_IF_COPY(pgraster, 0);
149 elog(ERROR,
"RASTER_getBandPixelTypeName: Could not deserialize raster");
156 elog(NOTICE,
"Could not find raster band of index %d when getting pixel type name. Returning NULL", bandindex);
158 PG_FREE_IF_COPY(pgraster, 0);
164 result = palloc(VARHDRSZ + name_size);
169 memset(VARDATA(result), 0, name_size);
170 ptr = (
char *)result + VARHDRSZ;
173 size = VARHDRSZ + strlen(ptr);
174 SET_VARSIZE(result, size);
177 PG_FREE_IF_COPY(pgraster, 0);
179 PG_RETURN_TEXT_P(result);
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
const char * rt_pixtype_name(rt_pixtype pixtype)
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): ...