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

Definition at line 1774 of file rt_pg.c.

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

1775 {
1776  rt_pgraster *pgraster = NULL;
1777  rt_pgraster *pgrtn = NULL;
1778  rt_raster raster;
1779  double size = PG_GETARG_FLOAT8(1);
1780 
1781  if (PG_ARGISNULL(0))
1782  PG_RETURN_NULL();
1783  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1784  raster = rt_raster_deserialize(pgraster, FALSE);
1785  if (!raster) {
1786  PG_FREE_IF_COPY(pgraster, 0);
1787  elog(ERROR, "RASTER_setScale: Could not deserialize raster");
1788  PG_RETURN_NULL();
1789  }
1790 
1791  rt_raster_set_scale(raster, size, size);
1792 
1793  pgrtn = rt_raster_serialize(raster);
1794  rt_raster_destroy(raster);
1795  PG_FREE_IF_COPY(pgraster, 0);
1796  if (!pgrtn)
1797  PG_RETURN_NULL();
1798 
1799  SET_VARSIZE(pgrtn, pgrtn->size);
1800  PG_RETURN_POINTER(pgrtn);
1801 }
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_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_api.c:5442
#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: