Make use of open global elevation data from [Terrain Tiles](https://registry.opendata.aws/terrain-tiles) to create digital elevation models (DEM) on the fly.
Project description
MEMDEM
Make use of open global elevation data from Terrain Tiles to create digital elevation models (DEM) on the fly.
The memdem project credits the data source providers. Any use of memdem for redistribution, resale, presentation or publication of the data available from the Terrain Tiles dataset is required to make a similar attribution. See here for more information.
Installation
memdem depends on
- rasterio[s3]
- morecantile
Linux / OSX
pip install memdem
Windows
note: Rasterio does not provide official windows wheels, ensure GDAL is installed in order to install rasterio dependency.
Unofficial wheels
Unofficial rasterio wheels (includes GDAL).
Conda
conda create -yn memdem python=3.9
conda activate memdem
conda install -c conda-forge gdal
Once GDAL is installed, the environment variable GDAL_VERSION
may need to be set in order to install rasterio dependency.
pip install memdem
Quickstart
import rasterio
from rasterio.crs. import CRS
import memdem
# define a bounding box
bounds = (-123.61735447008346, 48.91185687803928, -122.74734074899379, 49.52797572603976)
# create an instance of DEMTiles
demtiles = memdem.DEMTiles(
bounds,
zoom=10
)
# behold, a DEM created on the fly
with demtiles.open() as dem:
lon, lat = (-123.17911189115098, 49.26435101976154)
point_xy = rasterio.warp.transform(CRS.from_epsg(4326), dem.crs, [lon], [lat])
print(next(dem.sample(zip(*point_xy)))) # 20
# save DEM to file for later use
demtiles.to_file("path/to/dem.vrt")
Notes
Coordinate Reference System
Terrain Tiles are referenced to the EPSG:3857 aka Web Mercator projection. However the vertical datum (what reference is used for elevation values e.g. WGS84 ellipsoid) may vary depending on the source data. For accurate elevation results, it may be required to use source data with a well-defined vertical datum. For example, SRTM data has vertical datum EGM96.
AWS credentials
The Terrain Tiles dataset is avaiable freely and does not require aws credentials to access. Rasterio uses signed requests by default and may result in an error if it cannot locate your aws credentials. By default, memdem wraps the the DEMTiles.open
context in a rasterio.Env(aws_unsigned=True)
context. For operations requiring dataset reads outside of the DEMTiles.open
context (e.g. when opening a previously saved VRT) ensure you do so within a rasterio.Env(aws_unsigned=True)
block.
Project details
Release history Release notifications | RSS feed
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 memdem-0.1.0.post1.tar.gz
.
File metadata
- Download URL: memdem-0.1.0.post1.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1a43bb74c8b67eb7d32affa7b3e7a6ba6b719f931b7d921539a2f8351e3e124 |
|
MD5 | 242f70efa1a98a43c387817f5c907cf4 |
|
BLAKE2b-256 | fa1a5577085b4f6101527b82cd58fefb22b6f05638a901dd4508b8d4f09b39a1 |