263 LWGEOM *lwgeom_in, *lwgeom_out;
267 const char *func_name;
271 text *resample_text = PG_GETARG_TEXT_P(2);
275 func_name = get_func_name(fcinfo->flinfo->fn_oid);
276 if (strcmp(func_name,
"st_setz") == 0)
278 else if (strcmp(func_name,
"st_setm") == 0)
281 elog(ERROR,
"%s called from unexpected SQL signature", __func__);
284 gser = (
GSERIALIZED*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
286 elog(ERROR,
"Cannot copy value into an empty geometry");
291 pgraster = (
rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
295 elog(ERROR,
"Could not deserialize raster");
300 band = PG_GETARG_INT32(3);
301 if (band < 1 || band > num_bands) {
302 elog(NOTICE,
"Invalid band index %d. Must be between 1 and %u",
band, num_bands);
308 elog(ERROR,
"Raster and geometry do not have the same SRID");
330 if (err !=
ES_NONE || !lwgeom_out) {
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
GSERIALIZED * gserialized_from_lwgeom(LWGEOM *geom, size_t *size)
Allocate a new GSERIALIZED from an LWGEOM.
void lwgeom_free(LWGEOM *geom)
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
rt_errorstate
Enum definitions.
uint16_t rt_raster_get_num_bands(rt_raster raster)
rt_errorstate rt_raster_copy_to_geometry(rt_raster raster, uint32_t bandnum, char dim, rt_resample_type resample, const LWGEOM *lwgeom_in, LWGEOM **lwgeom_out)
Copy values from a raster to the points on a geometry using the requested interpolation type.
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
static rt_resample_type resample_text_to_type(text *txt)