Created
May 1, 2019 04:38
-
-
Save danwild/3d622487fe9cbd0ef724cc2b1863909b to your computer and use it in GitHub Desktop.
Get GeoTIFF extent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gdal | |
from gdalconst import GA_ReadOnly | |
data = gdal.Open('C:/Temp/myimage.tif', GA_ReadOnly) | |
geoTransform = data.GetGeoTransform() | |
minx = geoTransform[0] | |
maxy = geoTransform[3] | |
maxx = minx + geoTransform[1] * data.RasterXSize | |
miny = maxy + geoTransform[5] * data.RasterYSize | |
print (minx, miny, maxx, maxy) | |
data = None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment