Created
March 5, 2020 03:13
-
-
Save invisiblefunnel/41796a5e38b13ba324c739f4cc7f9762 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 utm | |
from shapely.geometry import Point | |
def bbox_from_point(point, meters): | |
easting, northing, zn, zl = utm.from_latlon(point.y, point.x) | |
point = Point(easting, northing) | |
bounds = point.buffer(meters).bounds | |
minx, miny, maxx, maxy = bounds | |
result = [] | |
for e, n in ((minx, miny), (maxx, maxy)): | |
lat, lon = utm.to_latlon(e, n, zn, zl) | |
result.append(lon) | |
result.append(lat) | |
return tuple(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment