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

Definition at line 2125 of file rt_pg.c.

References rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), rt_raster_serialize(), rt_raster_set_offsets(), rt_raster_set_phys_params(), rt_raster_serialized_t::size, and TRUE.

2126 {
2127  rt_pgraster *pgraster = NULL;
2128  rt_pgraster *pgrtn = NULL;
2129  rt_raster raster;
2130  float8 imag, jmag, theta_i, theta_ij, xoffset, yoffset;
2131 
2132  if (
2133  PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2) ||
2134  PG_ARGISNULL(3) || PG_ARGISNULL(4) ||
2135  PG_ARGISNULL(5) || PG_ARGISNULL(6)
2136  ) {
2137  PG_RETURN_NULL();
2138  }
2139 
2140  /* get the inputs */
2141  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
2142  imag = PG_GETARG_FLOAT8(1);
2143  jmag = PG_GETARG_FLOAT8(2);
2144  theta_i = PG_GETARG_FLOAT8(3);
2145  theta_ij = PG_GETARG_FLOAT8(4);
2146  xoffset = PG_GETARG_FLOAT8(5);
2147  yoffset = PG_GETARG_FLOAT8(6);
2148 
2149  raster = rt_raster_deserialize(pgraster, TRUE);
2150  if (!raster) {
2151  PG_FREE_IF_COPY(pgraster, 0);
2152  elog(ERROR, "RASTER_setGeotransform: Could not deserialize raster");
2153  PG_RETURN_NULL();
2154  }
2155 
2156  /* store the new geotransform */
2157  rt_raster_set_phys_params(raster, imag,jmag,theta_i,theta_ij);
2158  rt_raster_set_offsets(raster, xoffset, yoffset);
2159 
2160  /* prep the return value */
2161  pgrtn = rt_raster_serialize(raster);
2162  rt_raster_destroy(raster);
2163  PG_FREE_IF_COPY(pgraster, 0);
2164  if (!pgrtn)
2165  PG_RETURN_NULL();
2166 
2167  SET_VARSIZE(pgrtn, pgrtn->size);
2168  PG_RETURN_POINTER(pgrtn);
2169 }
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
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
#define TRUE
Definition: dbfopen.c:170
void rt_raster_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_api.c:5504

Here is the call graph for this function: