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

Definition at line 1601 of file rt_pg.c.

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

1602 {
1603  rt_pgraster *pgraster = NULL;
1604  rt_pgraster *pgrtn = NULL;
1605  rt_raster raster;
1606  int32_t newSRID = PG_GETARG_INT32(1);
1607 
1608  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
1609  pgraster = (rt_pgraster *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1610 
1611  raster = rt_raster_deserialize(pgraster, FALSE);
1612  if (!raster) {
1613  PG_FREE_IF_COPY(pgraster, 0);
1614  elog(ERROR, "RASTER_setSRID: Could not deserialize raster");
1615  PG_RETURN_NULL();
1616  }
1617 
1618  rt_raster_set_srid(raster, newSRID);
1619 
1620  pgrtn = rt_raster_serialize(raster);
1621  rt_raster_destroy(raster);
1622  PG_FREE_IF_COPY(pgraster, 0);
1623  if (!pgrtn) PG_RETURN_NULL();
1624 
1625  SET_VARSIZE(pgrtn, pgrtn->size);
1626 
1627  PG_RETURN_POINTER(pgrtn);
1628 }
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
void rt_raster_set_srid(rt_raster raster, int32_t srid)
Set raster's SRID.
Definition: rt_api.c:5668
#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

Here is the call graph for this function: