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. 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
Name | Type | Description |
---|---|---|
tuple | Return the x, y coordinates of the upper left corner of the cell. |
Examples
# Load a dataset
= fiat.fio.GridSource(<some raster file>)
gs # Get the geotransform
= gs.geotransform
gtf # Calculate the coordinates
= pixel2world(gtf, <column>, <row>) x, y