项目作者: sgherbst

项目描述 :
Python library for accessing elevation data
高级语言: Python
项目地址: git://github.com/sgherbst/pyhigh.git
创建时间: 2020-03-14T19:39:20Z
项目社区:https://github.com/sgherbst/pyhigh

开源协议:MIT License

下载


pyhigh

Actions Status
License: MIT
PyPI version

pyhigh is a Python package for accessing elevation data, which is retrieved from an ArduPilot dataset. The package uses caching to avoid unecessary downloads, but please respect ArduPilot’s download policies.

Installation

  1. > 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:

  1. > pyhigh --lat 36.52011 --lon -118.671
  2. 1884

As necessary, files will be download from an ArduPilot dataset and cache in the folder pyhigh/pyhigh/.cache. To clear this cache, use the --clean argument:

  1. > pyhigh --clean

Python API

The get_elevation function returns the elevation, in meters, at the given latitude and longitude.

  1. >>> from pyhigh import get_elevation
  2. >>> get_elevation(lat=36.52011, lon=-118.671)
  3. 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.

  1. >>> from pyhigh import get_elevation_batch
  2. >>> get_elevation_batch([(36.52011, -118.671),
  3. ... (36.62011, -118.771)])
  4. 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:

  1. >>> from pyhigh import clear_cache
  2. >>> clear_cache()