PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ RASTER_setRotation()

Datum RASTER_setRotation ( PG_FUNCTION_ARGS  )

Definition at line 1144 of file rtpg_raster_properties.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.

Referenced by RASTER_setGeotransform().

1145 {
1146  rt_pgraster *pgraster = NULL;
1147  rt_pgraster *pgrtn = NULL;
1148  rt_raster raster;
1149  double rotation = PG_GETARG_FLOAT8(1);
1150  double imag, jmag, theta_i, theta_ij;
1151 
1152  if (PG_ARGISNULL(0))
1153  PG_RETURN_NULL();
1154  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1155 
1156  raster = rt_raster_deserialize(pgraster, FALSE);
1157  if (! raster ) {
1158  PG_FREE_IF_COPY(pgraster, 0);
1159  elog(ERROR, "RASTER_setRotation: Could not deserialize raster");
1160  PG_RETURN_NULL();
1161  }
1162 
1163  /* preserve all defining characteristics of the grid except for rotation */
1164  rt_raster_get_phys_params(raster, &imag, &jmag, &theta_i, &theta_ij);
1165  rt_raster_set_phys_params(raster, imag, jmag, rotation, theta_ij);
1166 
1167  pgrtn = rt_raster_serialize(raster);
1168  rt_raster_destroy(raster);
1169  PG_FREE_IF_COPY(pgraster, 0);
1170  if (!pgrtn)
1171  PG_RETURN_NULL();
1172 
1173  SET_VARSIZE(pgrtn, pgrtn->size);
1174  PG_RETURN_POINTER(pgrtn);
1175 }
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_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
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:2250
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: