PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum RASTER_getPixelHeight ( PG_FUNCTION_ARGS  )

Definition at line 2093 of file rt_pg.c.

References rtrowdump::raster, rt_raster_deserialize(), rt_raster_destroy(), rt_raster_get_x_skew(), rt_raster_get_y_scale(), and TRUE.

2094 {
2095  rt_pgraster *pgraster;
2096  rt_raster raster;
2097  double yscale;
2098  double xskew;
2099  double pheight;
2100 
2101  if (PG_ARGISNULL(0)) PG_RETURN_NULL();
2102  pgraster = (rt_pgraster *)PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0), 0, sizeof(struct rt_raster_serialized_t));
2103 
2104  raster = rt_raster_deserialize(pgraster, TRUE);
2105  if (!raster) {
2106  PG_FREE_IF_COPY(pgraster, 0);
2107  elog(ERROR, "RASTER_getPixelHeight: Could not deserialize raster");
2108  PG_RETURN_NULL();
2109  }
2110 
2111  yscale = rt_raster_get_y_scale(raster);
2112  xskew = rt_raster_get_x_skew(raster);
2113  pheight = sqrt(yscale*yscale + xskew*xskew);
2114 
2115  rt_raster_destroy(raster);
2116  PG_FREE_IF_COPY(pgraster, 0);
2117 
2118  PG_RETURN_FLOAT8(pheight);
2119 }
void rt_raster_destroy(rt_raster raster)
Release memory associated to a raster.
Definition: rt_api.c:5387
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
Definition: rt_api.c:5486
tuple raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
Definition: rtrowdump.py:123
Struct definitions.
Definition: rt_api.h:2175
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
Definition: rt_api.c:5464
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
Definition: rt_api.c:8350
#define TRUE
Definition: dbfopen.c:170

Here is the call graph for this function: