PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_setUpperLeftXY ( PG_FUNCTION_ARGS  )

Definition at line 2019 of file rt_pg.c.

References FALSE, rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), rt_raster_serialize(), rt_raster_set_offsets(), and rt_raster_serialized_t::size.

2020 {
2021  rt_pgraster *pgraster = NULL;
2022  rt_pgraster *pgrtn = NULL;
2023  rt_raster raster;
2024  double xoffset = PG_GETARG_FLOAT8(1);
2025  double yoffset = PG_GETARG_FLOAT8(2);
2026 
2027  if (PG_ARGISNULL(0))
2028  PG_RETURN_NULL();
2029  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
2030  raster = rt_raster_deserialize(pgraster, FALSE);
2031  if (!raster) {
2032  PG_FREE_IF_COPY(pgraster, 0);
2033  elog(ERROR, "RASTER_setUpperLeftXY: Could not deserialize raster");
2034  PG_RETURN_NULL();
2035  }
2036 
2037  rt_raster_set_offsets(raster, xoffset, yoffset);
2038 
2039  pgrtn = rt_raster_serialize(raster);
2040  rt_raster_destroy(raster);
2041  PG_FREE_IF_COPY(pgraster, 0);
2042  if (!pgrtn)
2043  PG_RETURN_NULL();
2044 
2045  SET_VARSIZE(pgrtn, pgrtn->size);
2046  PG_RETURN_POINTER(pgrtn);
2047 }
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_api.c:8158
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
#define FALSE
Definition: dbfopen.c:169
Struct definitions.
Definition: rt_api.h:2175
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_api.c:5504

Here is the call graph for this function: