575 int32_t bandindex = 0;
578 bool skipset =
FALSE;
587 bandindex = PG_GETARG_INT32(1);
590 elog(NOTICE,
"Invalid band index (must use 1-based). Value not set. Returning original raster");
595 if (PG_ARGISNULL(2)) {
596 elog(NOTICE,
"X coordinate can not be NULL when setting pixel value. Value not set. Returning original raster");
600 x = PG_GETARG_INT32(2);
602 if (PG_ARGISNULL(3)) {
603 elog(NOTICE,
"Y coordinate can not be NULL when setting pixel value. Value not set. Returning original raster");
607 y = PG_GETARG_INT32(3);
612 pgraster = (
rt_pgraster *) PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(0));
616 PG_FREE_IF_COPY(pgraster, 0);
617 elog(ERROR,
"RASTER_setPixelValue: Could not deserialize raster");
625 elog(NOTICE,
"Could not find raster band of index %d when setting " 626 "pixel value. Value not set. Returning original raster",
628 PG_RETURN_POINTER(pgraster);
632 if (PG_ARGISNULL(4)) {
634 elog(NOTICE,
"Raster do not have a nodata value defined. " 635 "Set band nodata value first. Nodata value not set. " 636 "Returning original raster");
637 PG_RETURN_POINTER(pgraster);
645 pixvalue = PG_GETARG_FLOAT8(4);
653 PG_FREE_IF_COPY(pgraster, 0);
657 SET_VARSIZE(pgrtn, pgrtn->
size);
658 PG_RETURN_POINTER(pgrtn);
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
#define POSTGIS_RT_DEBUGF(level, msg,...)
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.