Skip to main content

Global geographic elevation data made easy. Elevation provides easy download, cache and access of the global datasets:

Note that any download policies and attribution requirements of the respective providers apply.

This Open Source project is sponsored by B-Open.

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.

Note that starting from elevation v1.1 only Python 3 is officially supported. To get the last version sporting Python 2 support please use pip install elevation==1.0.6.

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 30m DEM of Rome, around 41.9N 12.5E, to the Rome-30m-DEM.tif file:

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

For the SRTM 90m DEM use:

$ eio --product SRTM3 clip -o Rome-90m-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 reference system EPSG:4326 for those who care) given as left bottom right top similarly to the rio command form rasterio.

If you have installed the packages rasterio and fiona you can clip a DEM on the same extent of any other geospatial data source supported by GDAL and OGR, for example if you have a georeference image MyImage.tif you can clip the corresponding DEM with:

$ eio clip -o MyImage-DEM.tif --reference MyImage.tif  # enable with: $ pip install rasterio

The --reference option can take also vector data as input:

$ eio clip -o MyShapefile-DEM.tif --reference MyShapefile.shp  # enable with: $ pip install fiona

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

The clip sub-command doesn’t allow automatic download of a large amount of DEM tiles, please refer to the upstream providers’ websites to learn the preferred procedures for bulk download.

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

$ eio clean

Command line reference

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

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

Options:
  --version                       Show the version and exit.
  --product [SRTM1|SRTM3|SRTM1_ELLIP]
                                  DEM product choice.  [default: SRTM1]
  --cache_dir DIRECTORY           Root of the DEM cache folder.  [default:
                                  /Users/amici/Library/Caches/elevation]
  --help                          Show this message and exit.

Commands:
  clean      Clean up the product cache from temporary files.
  clip       Clip the DEM to given bounds.
  distclean  Remove the product cache entirely.
  info       Show info about the product cache.
  seed       Seed the DEM to given bounds.
  selfcheck  Audit the system for common issues.

The clip sub-command:

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

Options:
  -o, --output PATH     Path to output file. Existing files will be
                        overwritten.  [default: out.tif]
  --bounds FLOAT...     Output bounds in 'left bottom right top' order.
  -m, --margin TEXT     Decimal degree margin added to the bounds. Use '%' for
                        percent margin.  [default: 0]
  -r, --reference TEXT  Use the extent of a reference GDAL/OGR data source as
                        output bounds.
  --help                Show this message and exit.

Defaults can be defined by setting environment variables prefixed with EIO, e.g. EIO_PRODUCT=SRTM3 and EIO_CLIP_MARGIN=10%.

Python API

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

>>> import elevation
>>> # clip the default 30m DEM of Rome and save it to Rome-DEM.tif
>>> elevation.clip(bounds=(12.35, 41.8, 12.65, 42), output='Rome-DEM.tif')
>>> # clean up stale temporary files and fix the cache in the event of a server error
>>> elevation.clean()

Project resources

Documentation

https://elevation.bopen.eu

Support

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

Development

https://github.com/bopen/elevation

Download

https://pypi.org/project/elevation

Code quality

Coverage status on Codecov

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.

Metadata

Release files for elevation 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elevation 1.1.4
File Size Uploaded
elevation-1.1.4.tar.gz 28.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elevation 1.1.4
File Interpreter ABI Platform
elevation-1.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 46.5 kB

Release files / elevation-1.1.4.tar.gz

Download URL elevation-1.1.4.tar.gz
Size 28.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0e68778edf43110ad6a62ca491e32d9f4d1a59c41a720688ff0066ee1de87293
BLAKE2b-256 checksum
How to use checksums
3fd9c25215783445df2a09de95b52e4340bcc867ddd9519540e17985354fd04c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / elevation-1.1.4-py3-none-any.whl

Download URL elevation-1.1.4-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4749af4e9fd6189884cd229211eaba0187be6dac5de06d3df9d657d85104ec50
BLAKE2b-256 checksum
How to use checksums
992c828e1022e7d2ec44fe10f976ca436268f273f4f0b5eb43ece4c0038849b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.9.11

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page