PostGIS 3.0.6dev-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 755 of file rt_raster.c.

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 (FLT_EQ(_gt[1], 0.0) || FLT_EQ(_gt[5], 0.0))
771 {
773 }
774
775 RASTER_DEBUGF(4, "gt = (%f, %f, %f, %f, %f, %f)",
776 _gt[0],
777 _gt[1],
778 _gt[2],
779 _gt[3],
780 _gt[4],
781 _gt[5]
782 );
783
784 GDALApplyGeoTransform(_gt, xr, yr, xw, yw);
785 RASTER_DEBUGF(4, "GDALApplyGeoTransform (c -> g) for (%f, %f) = (%f, %f)",
786 xr, yr, *xw, *yw);
787
788 return ES_NONE;
789}
#define RASTER_DEBUGF(level, msg,...)
Definition librtcore.h:299
#define FLT_EQ(x, y)
Definition librtcore.h:2235
@ ES_NONE
Definition librtcore.h:180
void rt_raster_get_geotransform_matrix(rt_raster raster, double *gt)
Get 6-element array of raster geotransform matrix.
Definition rt_raster.c:706

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: