PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_setScale()

Datum RASTER_setScale ( PG_FUNCTION_ARGS  )

Definition at line 923 of file rtpg_raster_properties.c.

924 {
925  rt_pgraster *pgraster = NULL;
926  rt_pgraster *pgrtn = NULL;
928  double size = PG_GETARG_FLOAT8(1);
929 
930  if (PG_ARGISNULL(0))
931  PG_RETURN_NULL();
932  pgraster = (rt_pgraster *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
933  raster = rt_raster_deserialize(pgraster, FALSE);
934  if (!raster) {
935  PG_FREE_IF_COPY(pgraster, 0);
936  elog(ERROR, "RASTER_setScale: Could not deserialize raster");
937  PG_RETURN_NULL();
938  }
939 
940  rt_raster_set_scale(raster, size, size);
941 
942  pgrtn = rt_raster_serialize(raster);
944  PG_FREE_IF_COPY(pgraster, 0);
945  if (!pgrtn)
946  PG_RETURN_NULL();
947 
948  SET_VARSIZE(pgrtn, pgrtn->size);
949  PG_RETURN_POINTER(pgrtn);
950 }
#define FALSE
Definition: dbfopen.c:168
void rt_raster_set_scale(rt_raster raster, double scaleX, double scaleY)
Set scale in projection units.
Definition: rt_raster.c:137
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
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 FALSE, rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), rt_raster_serialize(), rt_raster_set_scale(), and rt_raster_serialized_t::size.

Here is the call graph for this function: