PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ RASTER_getPixelHeight()

Datum RASTER_getPixelHeight ( PG_FUNCTION_ARGS  )

Definition at line 404 of file rtpg_raster_properties.c.

405 {
406  rt_pgraster *pgraster;
408  double yscale;
409  double xskew;
410  double pheight;
411 
412  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
413  pgraster = (rt_pgraster *)PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
414 
415  raster = rt_raster_deserialize(pgraster, TRUE);
416  if (!raster) {
417  PG_FREE_IF_COPY(pgraster, 0);
418  elog(ERROR, "RASTER_getPixelHeight: Could not deserialize raster");
419  PG_RETURN_NULL();
420  }
421 
422  yscale = rt_raster_get_y_scale(raster);
423  xskew = rt_raster_get_x_skew(raster);
424  pheight = sqrt(yscale*yscale + xskew*xskew);
425 
427  PG_FREE_IF_COPY(pgraster, 0);
428 
429  PG_RETURN_FLOAT8(pheight);
430 }
#define TRUE
Definition: dbfopen.c:169
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
Definition: rt_raster.c:181
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_raster.c:82
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
Definition: rt_raster.c:159
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_get_x_skew(), rt_raster_get_y_scale(), and TRUE.

Here is the call graph for this function: