Skip to content

About

Elevation data that offers Efficiency, Simplicity, Coverage, Accuracy, and Size.

Resources

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

OpenZenith

Global elevation data platform — query, analyze, and visualize terrain anywhere on Earth.

Live site: openzenith.org · Map · Globe · Explore · WASM Demo
API base: openzenith.cyopsys.com


What is OpenZenith?

OpenZenith is a geospatial SDK + REST API for working with global elevation data. It provides a unified Python interface for querying point elevations, loading terrain grids, and running terrain analysis (slope, aspect, hillshade, viewshed, hydrology) — with full offline support once local data is cached.

The key differentiator is low-latency local processing: no API calls needed for elevation queries when using local .merged tiles, and no complex DEM data setup required. Scientists, GIS engineers, and app developers get elevation data without managing SRTM/GEBCO tile downloads, coordinate conversions, or hydrology preprocessing.

Works entirely offline after installing the Python SDK and optional local data. Rust/WASM compute kernels handle CPU-intensive terrain analysis (D8 flow, viewshed, OZT2 decode) — running in-browser via WASM or as a local subprocess.


Key Benefits

  • Zero-config: pip install and query elevation in 2 lines of Python
  • Offline-first: Local SRTM .merged tiles — no network required for elevation queries
  • Low-latency: Rust/WASM compute kernels for D8 flow, viewshed, OZT2 decode — runs in-browser or subprocess
  • Complete terrain analysis: slope, aspect, hillshade, viewshed, TPI, roughness, curvature, watersheds, stream extraction, downstream tracing
  • Production-ready: Fully typed (py.typed), 1,650 pytest tests (99% coverage gate; last measured 99.11%), clippy-clean Rust, typed TypeScript API

Quick Start

1. Install (30 seconds)

git clone https://github.com/aliasfoxkde/OpenZenith && cd OpenZenith
pip install .                       # Core SDK
pip install .[all]                  # All extras: compression, download,
                                    # analysis (aiohttp/rasterio/numba), viz, dev
pip install .[viz]                  # + matplotlib plotting helpers

Note: the SDK is not yet on PyPI (publishing is maintainer-gated — see docs/PUBLISHING.md), so the install is from source. Once the PyPI upload lands, these become pip install openzenith[…].

2. Query Elevation (works offline if tiles cached)

import openzenith as oz

# Single point — uses HuggingFace tiles if no local cache
elev = oz.get_elevation(40.7128, -74.0060)  # NYC → 10m
print(f"Elevation: {elev}m")

# Batch — parallel fetch with ThreadPoolExecutor
results = oz.get_elevation_batch([(40.7, -74.0), (48.8, 2.3), (35.7, 139.7)])

3. Terrain Analysis

from openzenith import load_elevation_grid, slope, aspect, hillshade
from openzenith.terrain import viewshed

# Load a 10km × 10km region around a point
grid = load_elevation_grid(lat=36.0, lon=-118.0, zoom=12, radius=200)
dem = grid['grid']

slope_map = slope(dem)            # Degrees slope (Horn's method)
aspect_map = aspect(dem)          # Compass degrees (0-360)
hillshade_map = hillshade(dem)     # 0-255 analytical hillshade

# Viewshed from an observer point
visible = viewshed(dem, observer_row=100, observer_col=100, radius=50)

4. Hydrology (D8 flow, watersheds, streams)

from openzenith.hydrology import (
    d8_flow_direction, flow_accumulation, extract_streams,
    delineate_watershed, trace_downstream
)

flow_dir = d8_flow_direction(dem)
accum = flow_accumulation(flow_dir)
streams = extract_streams(accum, threshold=100)

# Trace downstream from a point
trace = trace_downstream(36.0, -118.0)
print(f"Distance to ocean: {trace['total_distance']:.1f} km")

# Delineate entire watershed
ws = delineate_watershed(36.0, -118.0)
print(f"Watershed area: {ws['area_km2']:.1f} km²")

5. Local Data (optional — for offline use)

# Download SRTM tiles to ~/.cache/openzenith-dem/
openzenith download --region north-america --zoom-levels 0-10

# Or use HuggingFace directly (no local storage)
export HF_TOKEN=your_token_here

Python SDK Reference

Module Functions Notes
elevation get_elevation, get_elevation_batch, load_elevation_grid Parallel tile fetching
terrain slope, aspect, hillshade, viewshed, tpi, roughness, curvature, tri Vectorized NumPy
hydrology d8_flow_direction, flow_accumulation, extract_streams, delineate_watershed, trace_downstream, twi, fill_depressions D8 algorithm
tracing trace_downstream Adaptive tile loading
fuse FusedDEM SRTM + GEBCO seamless
viz plot_*, terrain_to_3d_mesh, terrain_to_glb, terrain_to_png Matplotlib + 3D export
geotiff export_geotiff, export_cog GeoTIFF/COG export
merged read_elevation_from_merged, MergedFile OZCHNK01 local dataset access
async_client ElevationClient, ElevationBatchProcessor aiohttp batch concurrency
tile_format_v2 encode, decode OZT2 tiles (gradient prediction + adaptive quantization; Brotli/Zstd/zlib per tile)
converter convert_tile, convert_directory SRTM .merged → OZT2 pipeline
backends OZT2Backend, OZT2HFBackend, OZT2R2Backend Local files, HuggingFace, S3-compatible (the R2 class targets any S3-compatible store — the platform's own R2 bucket was decommissioned 2026-09-27)

CLI Commands (36 total — highlights below)

openzenith query --lat 40.7 --lon -74.0
openzenith trace --lat 36.0 --lon -118.0
openzenith watershed --lat 36.0 --lon -118.0
openzenith slope --lat 36.0 --lon -118.0 --radius 5km
openzenith hillshade --lat 36.0 --lon -118.0 --radius 5km
openzenith viewshed --lat 36.0 --lon -118.0 --height 10
openzenith fill-depressions --lat 36.0 --lon -118.0 --radius 10km
openzenith flow-accum --lat 36.0 --lon -118.0 --radius 10km
openzenith streams --lat 36.0 --lon -118.0 --threshold 100
openzenith info
openzenith validate

REST API

Base URL: https://openzenith.cyopsys.com/api/ — 81 API routes under api/src/app/api/.

GET /elevation?lat=40.7&lon=-74.0
POST /elevation/batch  (up to 2000 points)
GET /slope?lat=40.7&lon=-74.0&radius=50
POST /watershed  {"lat": 36.0, "lon": -118.0}
POST /trace  {"lat": 36.0, "lon": -118.0}
GET /tile/{z}/{x}/{y}  (terrain tiles)

OGC tile services (WMTS)

Terrarium PNG elevation tiles are also served as an OGC WMTS 1.0.0 service, validated with GDAL as an independent client:

GET /tiles/WMTSCapabilities.xml              (capabilities document)
GET /tiles/{tileMatrixSetId}                 (OGC API - Tiles metadata)
GET /dem-tile/{z}/{x}/{y}                    (WebMercatorQuad tiles)
GET /tiles/WorldCRS84Quad/{z}/{row}/{col}    (true EPSG:4326 tiles)

Two tile matrix sets are advertised on separate layers: WebMercatorQuad (EPSG:3857) and WorldCRS84Quad (OGC 17-083r2, true lat/lon assembly — one layer per set, GDAL/QGIS-compatible).

Full API docs: https://openzenith.cyopsys.com/api/openapi.json


Architecture

Python SDK (local compute) ←→ REST API (cloud, 81 API routes)
                                     ↓
                              Cloudflare Pages
                                     ↓
                     HuggingFace (origin) + edge Cache API

Tech Stack

SDK Python 3.10+, NumPy, Rust (WASM + CLI)
API Next.js 15, TypeScript, Cloudflare Edge
Data SRTM 30m (HuggingFace), GEBCO 2025
Tests 1,650 pytest @ 99% gate (Python), 247 cargo test across feature sets (Rust core), 1,709 vitest across 115 files (TypeScript)

Data Layers (62 mountable data layers, 62 curated in api/src/lib/layers/registry.ts — 31 highlights below)

Weather & Climate

Layer Source Details
Earthquakes USGS Global seismic, magnitude + depth, timeline playback
Weather Radar RainViewer NEXRAD mosaic, animated precipitation
Weather Warnings NOAA NWS Watches, warnings, advisories (US)
Hurricane Tracks NOAA NHC Active cyclones with track animation
Wildfires NASA FIRMS VIIRS 3,000+ fire detections/day
Air Quality Open-Meteo AQI, PM2.5, PM10, NO₂, O₃
Lightning Blitzortung Real-time global strikes (WebSocket)
SIGMETs/AIRMETs NOAA AWC Aviation weather hazards
Volcano Alerts USGS Real-time alert status
Disaster Alerts GDACS Global disaster aggregation
Flood Extent Copernicus EMS Flood monitoring
Sea Ice NSIDC/OSI SAF Polar ice coverage
Burn Scars NASA FIRMS Active fire perimeters
Space Weather NOAA SWPC Aurora forecast, Kp index

Aviation & Maritime

Layer Source Details
Flights (ADS-B) OpenSky Network 10,800+ live aircraft positions
Military ADS-B ADSB Exchange Military transponder data (requires key)
Vessels (AIS) AISstream Ship tracking (WebSocket)

Infrastructure & Science

Layer Source Details
NLNOG Nodes NLNOG Ring 750+ network measurement nodes
Buildings Overture Maps Global building footprints
Satellites Celestrak 1,500+ orbital positions, notable labels
Population Density JRC GHSL 100m resolution global
Land Cover ESA WorldCover 44-class land use
Waterways HydroSHEDS/OSM Rivers, lakes, water features

Terrain & Imagery

Layer Source Details
Hillshade SRTM 30m Terrain shading
Elevation Color SRTM 30m Hypsometric color ramp
Data Accuracy Multi-source Resolution heatmap (default on)
Topo Contours SRTM 30m 100m/500m contour intervals
Bathymetry GEBCO 2025 Ocean depth shading
Satellite Imagery NASA GIBS MODIS Terra true color
Night Lights NASA VIIRS Black Marble city lights
Marine Weather Open-Meteo Wave height, SST, wind

Map Features

  • 10 basemaps — Dark, Dark+, Dark (no labels), Streets, Light, Positron, OpenStreetMap, Satellite, Topographic, Terrain
  • Opacity sliders on all raster layers
  • DD/DMS coordinate toggle in position panel
  • Elevation profiling — SVG sparkline on distance measurement
  • Annotations — draw points, lines, polygons with naming
  • Bookmarks — save/restore viewport + layers to localStorage
  • Export — GeoJSON (visible layers) + PNG screenshot
  • Earthquake timeline — 24H/7D/30D feed with play/pause animation
  • Hurricane animation — track position playback
  • Keyboard shortcuts — L layers, ? help, Esc close
  • Offline support — service worker with cache-first navigation
  • Accessibility — ARIA roles, keyboard navigation, live regions

License

GPL-3.0

About

Elevation data that offers Efficiency, Simplicity, Coverage, Accuracy, and Size.

Resources

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages