PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ RASTER_setRotation()

Datum RASTER_setRotation ( PG_FUNCTION_ARGS  )

Definition at line 1146 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().

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