PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_setGeotransform()

Datum RASTER_setGeotransform ( PG_FUNCTION_ARGS  )

Definition at line 1090 of file rtpg_raster_properties.c.

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

Here is the call graph for this function: