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

Definition at line 2269 of file rt_pg.c.

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

2270 {
2271  rt_pgraster *pgraster = NULL;
2272  rt_pgraster *pgrtn = NULL;
2273  rt_raster raster;
2274  double rotation = PG_GETARG_FLOAT8(1);
2275  double imag, jmag, theta_i, theta_ij;
2276 
2277  if (PG_ARGISNULL(0))
2278  PG_RETURN_NULL();
2279  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
2280 
2281  raster = rt_raster_deserialize(pgraster, FALSE);
2282  if (! raster ) {
2283  PG_FREE_IF_COPY(pgraster, 0);
2284  elog(ERROR, "RASTER_setRotation: Could not deserialize raster");
2285  PG_RETURN_NULL();
2286  }
2287 
2288  /* preserve all defining characteristics of the grid except for rotation */
2289  rt_raster_get_phys_params(raster, &imag, &jmag, &theta_i, &theta_ij);
2290  rt_raster_set_phys_params(raster, imag, jmag, rotation, theta_ij);
2291 
2292  pgrtn = rt_raster_serialize(raster);
2293  rt_raster_destroy(raster);
2294  PG_FREE_IF_COPY(pgraster, 0);
2295  if (!pgrtn)
2296  PG_RETURN_NULL();
2297 
2298  SET_VARSIZE(pgrtn, pgrtn->size);
2299  PG_RETURN_POINTER(pgrtn);
2300 }
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_phys_params(rt_raster rast, double i_mag, double j_mag, double theta_i, double theta_ij)
Calculates the geotransform coefficients and applies them to the supplied raster. ...
Definition: rt_api.c:5602
void rt_raster_get_phys_params(rt_raster rast, double *i_mag, double *j_mag, double *theta_i, double *theta_ij)
Calculates and returns the physically significant descriptors embodied in the geotransform attached t...
Definition: rt_api.c:5536
#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: