PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ RASTER_setGeotransform()

Datum RASTER_setGeotransform ( PG_FUNCTION_ARGS  )

Definition at line 1084 of file rtpg_raster_properties.c.

References PG_FUNCTION_INFO_V1(), rtrowdump::raster, RASTER_setRotation(), 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.

Referenced by RASTER_setUpperLeftXY().

1085 {
1086  rt_pgraster *pgraster = NULL;
1087  rt_pgraster *pgrtn = NULL;
1088  rt_raster raster;
1089  float8 imag, jmag, theta_i, theta_ij, xoffset, yoffset;
1090 
1091  if (
1092  PG_ARGISNULL(0) || PG_ARGISNULL(1) || PG_ARGISNULL(2) ||
1093  PG_ARGISNULL(3) || PG_ARGISNULL(4) ||
1094  PG_ARGISNULL(5) || PG_ARGISNULL(6)
1095  ) {
1096  PG_RETURN_NULL();
1097  }
1098 
1099  /* get the inputs */
1100  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1101  imag = PG_GETARG_FLOAT8(1);
1102  jmag = PG_GETARG_FLOAT8(2);
1103  theta_i = PG_GETARG_FLOAT8(3);
1104  theta_ij = PG_GETARG_FLOAT8(4);
1105  xoffset = PG_GETARG_FLOAT8(5);
1106  yoffset = PG_GETARG_FLOAT8(6);
1107 
1108  raster = rt_raster_deserialize(pgraster, TRUE);
1109  if (!raster) {
1110  PG_FREE_IF_COPY(pgraster, 0);
1111  elog(ERROR, "RASTER_setGeotransform: Could not deserialize raster");
1112  PG_RETURN_NULL();
1113  }
1114 
1115  /* store the new geotransform */
1116  rt_raster_set_phys_params(raster, imag,jmag,theta_i,theta_ij);
1117  rt_raster_set_offsets(raster, xoffset, yoffset);
1118 
1119  /* prep the return value */
1120  pgrtn = rt_raster_serialize(raster);
1121  rt_raster_destroy(raster);
1122  PG_FREE_IF_COPY(pgraster, 0);
1123  if (!pgrtn)
1124  PG_RETURN_NULL();
1125 
1126  SET_VARSIZE(pgrtn, pgrtn->size);
1127  PG_RETURN_POINTER(pgrtn);
1128 }
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_set_offsets(rt_raster raster, double x, double y)
Set insertion points in projection units.
Definition: rt_raster.c:199
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
Struct definitions.
Definition: librtcore.h:2213
#define TRUE
Definition: dbfopen.c:169
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: