Python library to get elevation data
Project description
pyhigh
pyhigh
is a Python package for accessing elevation data, which is retrieved from a USGS dataset. The package uses caching to avoid unecessary downloads from the USGS dataset, but please respect their download policies.
Installation
> pip install pyhigh
Usage
Command-line utility
The pyhigh
Python package includes a command-line tool of the same name to retreive the elevation at a particular latitude and longitude:
> pyhigh --lat 36.52011 --lon -118.671
1884
As necessary, files will be download from a USGS dataset and cache in the folder pyhigh/pyhigh/.cache
. To clear this cache, use the --clean
argument:
> pyhigh --clean
Python API
The get_elevation
function returns the elevation, in meters, at the given latitude and longitude.
>>> from pyhigh import get_elevation
>>> get_elevation(lat=36.52011, lon=-118.671)
1884
It is also possible to request a bunch elevations for a bunch of latitudes and longitudes at once. The result returned is a NumPy array of elevations.
>>> from pyhigh import get_elevation_batch
>>> get_elevation_batch([(36.52011, -118.671),
... (36.62011, -118.771)])
array([1884., 2438.])
This is more efficient than individual calls to get_elevation
because elevation reads are pooled together to avoid reading the same *.hgt
file multiple times.
Finally, the pyhigh
cache of *.hgt
files can be cleared with the API function clear_cache
:
>>> from pyhigh import clear_cache
>>> clear_cache()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pyhigh-0.0.6.tar.gz
.
File metadata
- Download URL: pyhigh-0.0.6.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e10df65fc0ca79a57cb8f0cb10b4a6fefa19b2c4e5d28a1c46cb6b4e37f48be8 |
|
MD5 | 7b804dd9e6834c0ac49d9dc2312094d6 |
|
BLAKE2b-256 | db8bf8101acb032d7a9c1bd5023678831ff04edaf2d42ad78d0deca1b89ed805 |