Created
November 20, 2017 05:12
-
-
Save danwild/4ef7a4b41244fcb2ce6d686d8646b4f1 to your computer and use it in GitHub Desktop.
Set GeoTIFF extent/bounds with python GDAL
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 | |
in_file = '/Users/foo/Desktop/reproject/before.tif' | |
out_file = '/Users/foo/Desktop/reproject/after.tif' | |
# minX, minY, maxX, maxY | |
new_bounds = [ | |
-78.0078239440917969, | |
-40.0333147430419922, | |
-66.0144157409667969, | |
-55.4858904266357422 | |
] | |
# dest, src, options | |
# http://gdal.org/python/osgeo.gdal-module.html#Translate | |
gdal.Translate(out_file, in_file, outputBounds = new_bounds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment