PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 637 of file rt_raster.c.

642 {
643 double _gt[6] = {0};
644
645 assert(NULL != raster);
646 assert(NULL != xw && NULL != yw);
647
648 if (NULL != gt)
649 memcpy(_gt, gt, sizeof(double) * 6);
650
651 /* scale of matrix is not set */
652 if (FLT_EQ(_gt[1], 0.0) || FLT_EQ(_gt[5], 0.0))
653 {
655 }
656
657 RASTER_DEBUGF(4, "gt = (%f, %f, %f, %f, %f, %f)",
658 _gt[0],
659 _gt[1],
660 _gt[2],
661 _gt[3],
662 _gt[4],
663 _gt[5]
664 );
665
666 GDALApplyGeoTransform(_gt, xr, yr, xw, yw);
667 RASTER_DEBUGF(4, "GDALApplyGeoTransform (c -> g) for (%f, %f) = (%f, %f)",
668 xr, yr, *xw, *yw);
669
670 return ES_NONE;
671}
#define RASTER_DEBUGF(level, msg,...)
Definition librtcore.h:308
#define FLT_EQ(x, y)
Definition librtcore.h:2436
@ ES_NONE
Definition librtcore.h:182
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition rt_raster.c:588

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().

Here is the call graph for this function:
Here is the caller graph for this function: