PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ RASTER_setSRID()

Datum RASTER_setSRID ( PG_FUNCTION_ARGS  )

Definition at line 884 of file rtpg_raster_properties.c.

References FALSE, PG_FUNCTION_INFO_V1(), rtrowdump::raster, RASTER_setScale(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_serialize(), rt_raster_set_srid(), and rt_raster_serialized_t::size.

Referenced by RASTER_worldToRasterCoord().

885 {
886  rt_pgraster *pgraster = NULL;
887  rt_pgraster *pgrtn = NULL;
889  int32_t newSRID = PG_GETARG_INT32(1);
890 
891  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
892  pgraster = (rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
893 
894  raster = rt_raster_deserialize(pgraster, FALSE);
895  if (!raster) {
896  PG_FREE_IF_COPY(pgraster, 0);
897  elog(ERROR, "RASTER_setSRID: Could not deserialize raster");
898  PG_RETURN_NULL();
899  }
900 
901  rt_raster_set_srid(raster, newSRID);
902 
903  pgrtn = rt_raster_serialize(raster);
904  rt_raster_destroy(raster);
905  PG_FREE_IF_COPY(pgraster, 0);
906  if (!pgrtn) PG_RETURN_NULL();
907 
908  SET_VARSIZE(pgrtn, pgrtn->size);
909 
910  PG_RETURN_POINTER(pgrtn);
911 }
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_raster.c:363
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
#define FALSE
Definition: dbfopen.c:168
Struct definitions.
Definition: librtcore.h:2213
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:717
Here is the call graph for this function:
Here is the caller graph for this function: