PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ RASTER_setUpperLeftXY()

Datum RASTER_setUpperLeftXY ( PG_FUNCTION_ARGS  )

Definition at line 1056 of file rtpg_raster_properties.c.

References FALSE, PG_FUNCTION_INFO_V1(), rtrowdump::raster, RASTER_setGeotransform(), rt_raster_deserialize(), rt_raster_destroy(), rt_raster_serialize(), rt_raster_set_offsets(), and rt_raster_serialized_t::size.

Referenced by RASTER_setSkewXY().

1057 {
1058  rt_pgraster *pgraster = NULL;
1059  rt_pgraster *pgrtn = NULL;
1060  rt_raster raster;
1061  double xoffset = PG_GETARG_FLOAT8(1);
1062  double yoffset = PG_GETARG_FLOAT8(2);
1063 
1064  if (PG_ARGISNULL(0))
1065  PG_RETURN_NULL();
1066  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1067  raster = rt_raster_deserialize(pgraster, FALSE);
1068  if (!raster) {
1069  PG_FREE_IF_COPY(pgraster, 0);
1070  elog(ERROR, "RASTER_setUpperLeftXY: Could not deserialize raster");
1071  PG_RETURN_NULL();
1072  }
1073 
1074  rt_raster_set_offsets(raster, xoffset, yoffset);
1075 
1076  pgrtn = rt_raster_serialize(raster);
1077  rt_raster_destroy(raster);
1078  PG_FREE_IF_COPY(pgraster, 0);
1079  if (!pgrtn)
1080  PG_RETURN_NULL();
1081 
1082  SET_VARSIZE(pgrtn, pgrtn->size);
1083  PG_RETURN_POINTER(pgrtn);
1084 }
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_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:725
Here is the call graph for this function:
Here is the caller graph for this function: