PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_setRotation()

Datum RASTER_setRotation ( PG_FUNCTION_ARGS  )

Definition at line 1148 of file rtpg_raster_properties.c.

1149 {
1150  rt_pgraster *pgraster = NULL;
1151  rt_pgraster *pgrtn = NULL;
1152  rt_raster raster;
1153  double rotation = PG_GETARG_FLOAT8(1);
1154  double imag, jmag, theta_i, theta_ij;
1155 
1156  if (PG_ARGISNULL(0))
1157  PG_RETURN_NULL();
1158  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1159 
1160  raster = rt_raster_deserialize(pgraster, FALSE);
1161  if (! raster ) {
1162  PG_FREE_IF_COPY(pgraster, 0);
1163  elog(ERROR, "RASTER_setRotation: Could not deserialize raster");
1164  PG_RETURN_NULL();
1165  }
1166 
1167  /* preserve all defining characteristics of the grid except for rotation */
1168  rt_raster_get_phys_params(raster, &imag, &jmag, &theta_i, &theta_ij);
1169  rt_raster_set_phys_params(raster, imag, jmag, rotation, theta_ij);
1170 
1171  pgrtn = rt_raster_serialize(raster);
1173  PG_FREE_IF_COPY(pgraster, 0);
1174  if (!pgrtn)
1175  PG_RETURN_NULL();
1176 
1177  SET_VARSIZE(pgrtn, pgrtn->size);
1178  PG_RETURN_POINTER(pgrtn);
1179 }
#define FALSE
Definition: dbfopen.c:168
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
Definition: rt_serialize.c:521
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_raster.c:231
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_raster.c:297
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_serialize.c:725
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:121
Struct definitions.
Definition: librtcore.h:2250

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.

Here is the call graph for this function: