Easy retrieval of seamless DEM from 3DEP across US.
Project description
Seamless3DEP: Streamlined Access to USGS 3DEP Topographic Data
Seamless3DEP is a lightweight Python package that simplifies access to topographic data from the USGS 3D Elevation Program (3DEP). Whether you need elevation data or its derivatives, Seamless3DEP provides an efficient interface to both static and dynamic 3DEP products.
Seamless3DEP utilizes connection pooling across threads (safely) to optimize service calls and minimize redundant connections. This reduces both the service load and the time required to retrieve data, making it an ideal tool for handling large-scale topographic data requests.
📚 Full documentation is available here.
Available Products
Static DEMs
- 1/3 arc-second (10 meters)
- 1 arc-second (30 meters)
- 2 arc-second (60 meters)
Dynamic Products
- Digital Elevation Model (DEM)
- Hillshade Derivatives:
- Gray Hillshade
- Multidirectional Hillshade
- GreyHillshade with Elevation Fill
- Hillshade with Elevation Tint
- Terrain Analysis:
- Aspect (Degrees and Map)
- Slope (Degrees and Map)
- Height (Ellipsoidal)
- Contours:
- Contour 25 (Dynamically generates 25 contours for the area of interest)
- Contour Smoothed 25 (Smoothed version of the 25 contours)
Core Functions
Seamless3DEP offers six main functions designed for efficient data retrieval and processing:
get_dem: Retrieves static DEMs within a specified bounding box. The function automatically splits large areas into manageable tiles, downloads data as GeoTIFF files in EPSG:4326, and supports resolutions of 10m, 30m, or 60m.get_map: Fetches any 3DEP product (including DEMs) with customizable parameters. Works with all available product types, allows custom resolution settings, and downloads in EPSG:3857. Due to service limitations, the output projection is not configurable.elevation_bygrid: Samples elevation values from the 10 m seamless DEM at a grid of longitude/latitude coordinates. Reads directly from the USGS Cloud-Optimized GeoTIFFs (EPSG:4269) and supports configurable resampling methods including nearest, bilinear, cubic, cubic spline, and Lanczos.decompose_bbox: Handles large area requests by breaking down extensive bounding boxes into optimal sizes based on resolution and maximum pixel count, ensuring efficient data retrieval.build_vrt: Creates virtual raster datasets by combining multiple GeoTIFF files. Requireslibgdal-coreinstallation and supports efficient data handling for large areas. Note thatlibgdal-coreis an optional dependency and is not installed whenseamless-3depis installed from PyPI. However, it is installed as a dependency whenseamless-3depis installed fromconda-forge.tiffs_to_da: Converts a list of GeoTIFF files to anxarray.DataArrayobject. This function is useful for combining multiple GeoTIFF files thatget_mapandget_demproduce into a singlexarray.DataArrayobject for further analysis. Note that for using this function,shapelyandrioxarrayneed to be installed.
Important Notes
- Bounding box coordinates should be in decimal degrees (WGS84) format: (west, south, east, north)
- Default projection for requesting maps is EPSG:3857
- EPSG:4326 output projection is not supported in
get_mapdue to service limitations
Installation
Choose your preferred installation method:
Using pip
pip install seamless-3dep
Using micromamba (recommended)
micromamba install -c conda-forge seamless-3dep
Alternatively, you can use conda or mamba.
Quick Start Guide
We can retrieve topographic data using Seamless3DEP in just a few lines of code. Then,
we can visualize or even reproject the data using rioxarray.
Retrieving a DEM
from pathlib import Path
import seamless_3dep as s3dep
import rioxarray as rxr
# Define area of interest (west, south, east, north)
bbox = (-105.7006276, 39.8472777, -104.869054, 40.298293)
data_dir = Path("data")
# Download DEM
tiff_files = s3dep.get_dem(bbox, data_dir)
# Convert to xarray.DataArray
dem = s3dep.tiffs_to_da(tiff_files, bbox, crs=4326)
Retrieving a Slope Map
slope_files = s3dep.get_map("Slope Degrees", bbox, data_dir)
dem = s3dep.tiffs_to_da(slope_files, bbox)
Contributing
We welcome contributions! Please see the contributing section for guidelines and instructions.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seamless_3dep-0.4.1.tar.gz.
File metadata
- Download URL: seamless_3dep-0.4.1.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bfa0013a42e27868d0c62b4889f7dbb9b2c76a22b90248098e44cd3dbaa8bed
|
|
| MD5 |
9ffb2a2009ae630068399b3751f63e51
|
|
| BLAKE2b-256 |
adc7d7795928aa168e5359e98586de1640d96fdfeb376d7d61855e7ecf523268
|
Provenance
The following attestation bundles were made for seamless_3dep-0.4.1.tar.gz:
Publisher:
release.yml on hyriver/seamless-3dep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seamless_3dep-0.4.1.tar.gz -
Subject digest:
4bfa0013a42e27868d0c62b4889f7dbb9b2c76a22b90248098e44cd3dbaa8bed - Sigstore transparency entry: 1096779775
- Sigstore integration time:
-
Permalink:
hyriver/seamless-3dep@9c97ed9bef65d88d25ea1b90f58731751949cd65 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/hyriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c97ed9bef65d88d25ea1b90f58731751949cd65 -
Trigger Event:
push
-
Statement type:
File details
Details for the file seamless_3dep-0.4.1-py3-none-any.whl.
File metadata
- Download URL: seamless_3dep-0.4.1-py3-none-any.whl
- Upload date:
- Size: 13.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
948d0b5c61fe5e5d8e07156747084d38a64c3ed9614f55807324bfc1ce917a59
|
|
| MD5 |
943c17696eb45a5183a75bf8058f4cd0
|
|
| BLAKE2b-256 |
ad7e78a611f9991d75c04cf4335ec4f02a4aea693ccbbfafc44caafb46cddbf6
|
Provenance
The following attestation bundles were made for seamless_3dep-0.4.1-py3-none-any.whl:
Publisher:
release.yml on hyriver/seamless-3dep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seamless_3dep-0.4.1-py3-none-any.whl -
Subject digest:
948d0b5c61fe5e5d8e07156747084d38a64c3ed9614f55807324bfc1ce917a59 - Sigstore transparency entry: 1096779776
- Sigstore integration time:
-
Permalink:
hyriver/seamless-3dep@9c97ed9bef65d88d25ea1b90f58731751949cd65 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/hyriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9c97ed9bef65d88d25ea1b90f58731751949cd65 -
Trigger Event:
push
-
Statement type: