Skip to main content

Python script to download global terrain digital elevation models, SRTM 30m DEM and SRTM 90m DEM.

Project description

Global geographic elevation data made easy. Elevation provides easy download, cache and access of the global datasets SRTM 30m Global 1 arc second V003 elaborated by NASA and NGA and SRTM 90m Digital Elevation Database v4.1 elaborated by CGIAR-CSI.

Note that any download policies of the respective providers apply.

Installation

Install the latest version of Elevation from the Python Package Index:

$ pip install elevation

The following dependencies need to be installed and working:

The following command runs some basic checks and reports common issues:

$ eio selfcheck
Your system is ready.

GNU make, curl and unzip come pre-installed with most operating systems. The best way to install GDAL command line tools varies across operating systems and distributions, please refer to the GDAL install documentation.

Command line usage

Identify the geographic bounds of the area of interest and fetch the DEM with the eio command. For example to clip the SRTM1 30m DEM of the area of Rome, around 42N 12.5W, to the Rome-DEM.tif file:

$ eio clip -o Rome-DEM.tif --bounds 12.35 41.8 12.65 42

The --bounds option accepts latitude and longitude coordinates (more precisely in geodetic coordinates in the WGS84 refernce system EPSG:4326 for those who care) given as left bottom right top similarly to the rio command form rasterio.

The first time an area is accessed Elevation downloads the data tiles from the USGS or CGIAR-CSI servers and caches them in GeoTiff compressed formats, subsequent accesses to the same and nearby areas are much faster.

It is possible to pre-populate the cache for an area, for example to seed the SRTM3 90m DEM of Italy execute:

$ eio --product SRTM3 seed --bounds 6.6 36.6 18.6 47.1

To clean up stale temporary files and to try fixing the cache in the event of a server error use:

$ eio --product SRTM3 clean

The eio command as the following sub-commands and options:

$ eio --help
Usage: eio [OPTIONS] COMMAND [ARGS]...

Options:
  --product [SRTM1|SRTM3]  DEM product choice (default: 'SRTM1').
  --cache_dir DIRECTORY    Root of the DEM cache folder (default: [...]).
  --make_flags TEXT        Options to be passed to make (default: '-k').
  --help                   Show this message and exit.

Commands:
  clean      Clean up the cache from temporary files.
  clip       Clip the DEM to given bounds.
  distclean  Clean up the cache from temporary files.
  info
  seed       Seed the DEM to given bounds.
  selfcheck  Audits your installation for common issues.

The seed sub-command:

$ eio seed --help
Usage: eio seed [OPTIONS]

Options:
  --bounds FLOAT...  Output bounds: left bottom right top.
  --help             Show this message and exit.

The clip sub-command:

$ eio clip --help
Usage: eio clip [OPTIONS]

Options:
  -o, --output PATH  Path to output file. Existing files will be overwritten.
  --bounds FLOAT...  Output bounds: left bottom right top.
  --help             Show this message and exit.

Python API

Every command has a corresponding API function in the elevation module:

import elevation

# clip the SRTM1 30m DEM of the area around Rome and save it to Rome-DEM.tif
elevation.clip(bounds=(12, 41.5, 13, 42.5), output='Rome-DEM.tif')

# seed the SRTM3 90m DEM of Italy
elevation.seed(product='SRTM3', bounds=(6.6 36.6 18.6 47.1))

Project resources

Documentation

http://elevation.bopen.eu

Support

https://stackoverflow.com/search?q=python+elevation

Development

https://github.com/bopen/elevation

Download

https://pypi-hypernode.com/pypi/elevation

Code quality

Build Status on Travis CI Coverage Status on Coveralls

Contributing

Contributions are very welcome. Please see the CONTRIBUTING document for the best way to help. If you encounter any problems, please file an issue along with a detailed description.

Authors:

License

Elevation is free and open source software distributed under the terms of the Apache License, Version 2.0.

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

elevation-0.9.8.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

elevation-0.9.8-py2.py3-none-any.whl (13.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file elevation-0.9.8.tar.gz.

File metadata

  • Download URL: elevation-0.9.8.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for elevation-0.9.8.tar.gz
Algorithm Hash digest
SHA256 ef70839c77a9b7eadc3010607b068d0da5635f521ed080ac4cd26e55d590b56f
MD5 cff7c996162b75ff7bca1aebc83354f9
BLAKE2b-256 4352dc79fc1c7f638cdfffe90a835ba433c50e69ba69265280ef4c741ec0c41d

See more details on using hashes here.

File details

Details for the file elevation-0.9.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for elevation-0.9.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 387ecbddf13b28db55b23e43722341d8ad986a4ebf1cec79417775673cbd72a5
MD5 2c959b8a732ab73bf20b2d927901177b
BLAKE2b-256 4d6b5df89c2593db579ab13f02b5a380d58f1605f3e11dbd9d9f38ee3fba32d0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page