Skip to main content

A Python package to simplify downloading and processing elevation data.

Project description


elevatr
elevatr

A Python package to simplify downloading and processing elevation data.
Enjoy exploring the heights of the world with elevatr! 🏔️🚀

PyPI Version MIT License CI status Docs status Coverage Code Style: Ruff Type Checking: Ty


Explore the docs »

🌄 Overview

elevatr is a Python library designed for downloading and processing elevation data. It is particularly useful for geospatial analyses and visualizations. The library supports high-resolution raster data and offers easy-to-use tools for displaying and exporting elevation information. 🗺️📊

📦 Installation

To install elevatr, run the following command:

pip install elevatr

🛠️ How To Use

📥 Download Elevation Data

Here is a simple example of how to use elevatr to download elevation data:

import elevatr as elv

# Define the bounding box of the area of interest (min_lon, min_lat, max_lon, max_lat)
bbx = (-5.14, 41.33, 9.56, 51.09)

# Set the level of precision (between 0 and 14)
zoom = 6

# Access the elevation data
raster = elv.get_elev_raster(locations=bbx, zoom=zoom)

📝 Note: Please choose the zoom level incrementally, a high level of zoom on a large area can take a lot of time and memory.

🖼️ Display the elevation data:

raster.show(cmap='terrain', clip_zero=True)

🌍 Example output:

alt text

🏔️ Visualize in 3D

raster.show_3d(
    solid=True,
    light_intensity=0.5,
    transparent_background=True,
    zscale=40,
    phi=30,
    theta=180,
    file_path="elevation.png",
)

Render a stunning 3D view of your elevation data! 🌐✨

🌍 Example output:

alt text

💾 Save to TIFF File

raster.to_tif("elevation.tif")

Save your elevation data to a TIFF file for further use! 🗂️✨

🌐 Data Sources

List of Sources

The underlying data sources are a mix of:

  • 3DEP: Formerly NED and NED Topobathy in the United States, 10 meters outside of Alaska, 3 meters in select land and territorial water areas.
  • ArcticDEM: Strips of 5 meter mosaics across all of the land north of 60° latitude, including Alaska, Canada, Greenland, Iceland, Norway, Russia, and Sweden.
  • CDEM: Canadian Digital Elevation Model in Canada, with variable spatial resolution (from 20-400 meters) depending on the latitude.
  • data.gov.uk: 2 meters over most of the United Kingdom.
  • data.gv.at: 10 meters over Austria.
  • ETOPO1: For ocean bathymetry, 1 arc-minute resolution globally.
  • EUDEM: In most of Europe at 30 meter resolution, including Albania, Austria, Belgium, Bosnia and Herzegovina, Bulgaria, Croatia, Cyprus, Czechia, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Iceland, Ireland, Italy, Kosovo, Latvia, Liechtenstein, Lithuania, Luxembourg, Macedonia, Malta, Montenegro, Netherlands, Norway, Poland, Portugal, Romania, Serbia, Slovakia, Slovenia, Spain, Sweden, Switzerland, and United Kingdom.
  • Geoscience Australia's DEM of Australia: 5 meters around coastal regions in South Australia, Victoria, and Northern Territory.
  • GMTED: Globally, coarser resolutions at 7.5", 15", and 30" in land areas.
  • INEGI: Continental relief in Mexico.
  • Kartverket: Digital Terrain Model, 10 meters over Norway.
  • LINZ: 8 meters over New Zealand.
  • SRTM: Globally except high latitudes, 30 meters (90 meters nominal quality) in land areas.

Data Sources per Zoom Level

Zoom Ocean Land
0 ETOPO1 ETOPO1
1 ETOPO1 ETOPO1
2 ETOPO1 ETOPO1
3 ETOPO1 ETOPO1
4 ETOPO1 GMTED
5 ETOPO1 GMTED
6 ETOPO1 GMTED
7 ETOPO1 SRTM, NRCAN in Canada, with GMTED in high latitudes above 60°
8 ETOPO1 SRTM, NRCAN in Canada, with GMTED in high latitudes above 60°
9 ETOPO1 SRTM, NRCAN in Canada, EUDEM in Europe, with GMTED in high latitudes above 60°
10 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway
11 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec and 1/9 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway
12 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec and 1/9 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway
13 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec and 1/9 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway
14 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec and 1/9 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway
15 ETOPO1, NED Topobathy in California SRTM, data.gov.at in Austria, NRCAN in Canada, SRTM, NED/3DEP 1/3 arcsec and 1/9 arcsec, data.gov.uk in United Kingdom, INEGI in Mexico, ArcticDEM in latitudes above 60°, LINZ in New Zealand, Kartverket in Norway

📝 Note: Information about data sources is provided here.

⚖️ License

Elevatr is licensed under the MIT License. This means you are free to use, modify, and distribute this software. However, the software is provided “as is”, without warranty of any kind.

🙏 Acknowledgments

This package is inspired by the great elevatr package for the R language. It was this package that inspired me to create a similar package to ease access to this data for Python users.

back to top


GitHub @titouanlegourrierec  · Email titouanlegourrierec@icloud.com

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

elevatr-0.5.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elevatr-0.5.0-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file elevatr-0.5.0.tar.gz.

File metadata

  • Download URL: elevatr-0.5.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for elevatr-0.5.0.tar.gz
Algorithm Hash digest
SHA256 9222150a111d21ece00ab83e32817fb59d8d1e898ebbc09849a1ac945dfe9013
MD5 84ccf591fa6f6df76fb8b4a78dadb79c
BLAKE2b-256 56d2bdc69e3bec009d4bbd58d9cae57e27e401a4536877f409c92259813fb852

See more details on using hashes here.

File details

Details for the file elevatr-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: elevatr-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for elevatr-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0db7f0f39330765c7e5da2223ad557c90bd412a63f5f4a38d8c2c590fc98143f
MD5 88058b471b1903b035b5458b5e40f98f
BLAKE2b-256 de3028e704cc90e780707c93ee7aa1f7bf60b8d0b92e109da38a142e77168fe4

See more details on using hashes here.

Supported by

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