PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ rt_raster_cell_to_geopoint()

rt_errorstate rt_raster_cell_to_geopoint ( rt_raster  raster,
double  xr,
double  yr,
double *  xw,
double *  yw,
double *  gt 
)

Convert an xr, yr raster point to an xw, yw point on map.

Parameters
raster: the raster to get info from
xr: the pixel's column
yr: the pixel's row
xw: output parameter, X ordinate of the geographical point
yw: output parameter, Y ordinate of the geographical point
gt: input/output parameter, 3x2 geotransform matrix
Returns
ES_NONE if success, ES_ERROR if error

Definition at line 755 of file rt_raster.c.

References ES_NONE, FLT_EQ, RASTER_DEBUGF, and rt_raster_get_geotransform_matrix().

Referenced by RASTER_rasterToWorldCoord(), RASTER_tile(), rt_raster_compute_skewed_raster(), rt_raster_from_two_rasters(), rt_raster_gdal_rasterize(), rt_raster_gdal_warp(), rt_raster_get_convex_hull(), rt_raster_get_envelope(), rt_raster_get_envelope_geom(), rt_raster_get_perimeter(), rt_raster_intersects(), rt_raster_intersects_algorithm(), rt_raster_same_alignment(), and test_raster_cell_to_geopoint().

760  {
761  double _gt[6] = {0};
762 
763  assert(NULL != raster);
764  assert(NULL != xw && NULL != yw);
765 
766  if (NULL != gt)
767  memcpy(_gt, gt, sizeof(double) * 6);
768 
769  /* scale of matrix is not set */
770  if (
771  FLT_EQ(_gt[1], 0) ||
772  FLT_EQ(_gt[5], 0)
773  ) {
775  }
776 
777  RASTER_DEBUGF(4, "gt = (%f, %f, %f, %f, %f, %f)",
778  _gt[0],
779  _gt[1],
780  _gt[2],
781  _gt[3],
782  _gt[4],
783  _gt[5]
784  );
785 
786  GDALApplyGeoTransform(_gt, xr, yr, xw, yw);
787  RASTER_DEBUGF(4, "GDALApplyGeoTransform (c -> g) for (%f, %f) = (%f, %f)",
788  xr, yr, *xw, *yw);
789 
790  return ES_NONE;
791 }
#define FLT_EQ(x, y)
Definition: librtcore.h:2185
gt
Definition: window.py:77
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition: rt_raster.c:706
#define RASTER_DEBUGF(level, msg,...)
Definition: librtcore.h:299
Here is the call graph for this function:
Here is the caller graph for this function: