pixel2world
gis.util.pixel2world(gtf, x, y)
Calculate coordinates based on pixel location.
(Thanks to the ogr cookbook!)
Parameters
Name | Type | Description | Default |
---|---|---|---|
gtf |
tuple | The geotransform of a grid dataset. Can be optained via the get_geotransform method. Has the following shape: (left, xres, xrot, upper, yrot, yres). | required |
x |
int | Column number of the pixel | required |
y |
int | Row number of the pixel | required |
Returns
Type | Description |
---|---|
tuple | Return the x, y coordinates of the upper left corner of the cell. |
Examples
# Load a dataset
= fiat.io.GridSource(<some raster file>)
gs # Get the geotransform
= gs.get_geotransform()
gtf # Calculate the coordinates
= pixel2world(gtf, <column>, <row>) x, y