Last active
July 1, 2019 21:27
-
-
Save pyRobShrk/8df3a3c422fb1c88882a5e41b284349f to your computer and use it in GitHub Desktop.
Python function to query USGS 10 meter 3DEP elevation for a given point (lat, long)
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
from http import client | |
def USGS10mElev(lat,lon): | |
usgs = client.HTTPConnection('nationalmap.gov') | |
usgs.request('GET','/epqs/pqs.php?x=%.6f&y=%.6f&units=FEET&output=xml'% (lon, lat)) | |
result = usgs.getresponse() | |
if result.status == 200: | |
xml = result.read() | |
return float(xml[xml.find(b'<Elevation>')+11:xml.find(b'</Elevation>')-1]) | |
else: return request |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also:
github.com/dgketchum/Metio/met/elevation.py