Skip to content

Commit

Permalink
Add bounds script
Browse files Browse the repository at this point in the history
  • Loading branch information
ansonl committed Nov 8, 2023
1 parent 67c89f7 commit a4959e8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/getTIFBounds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from osgeo import gdal
from osgeo import gdalconst
from osgeo.gdalconst import GA_ReadOnly

import sys

# Get TIF extents to 3d print
data = gdal.Open(sys.argv[1], 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])
print([f"bllat {miny}", f"bllon {minx}", f"trlat {maxy}", f"trlon {maxx}"])

0 comments on commit a4959e8

Please sign in to comment.