--- license: mit tags: - dem - elevation - terrain - copernicus - gebco - terrarium - maplibre - cesiumjs - bathymetry - global - tiles - openzenith size_categories: - 10M float: return (r * 256 + g + b / 256) - 32768 ``` ## Usage ### Python (`pip install openzenith`) ```python from openzenith import get_elevation, load_tiles # Download tiles from HuggingFace (zoom 0-8, ~5GB) tiles_dir = load_tiles(zoom_levels=[0, 1, 2, 3, 4, 5, 6, 7, 8]) # Query elevation at any lat/lon elev = get_elevation(40.7128, -74.0060) # New York City print(f"NYC elevation: {elev:.1f}m") # Batch queries from openzenith import get_elevation_batch elevations = get_elevation_batch([ (40.7128, -74.0060), # New York (35.6762, 139.6503), # Tokyo (27.9881, 86.9250), # Mount Everest ]) ``` ### MapLibre GL JS ```javascript map.addSource("terrain", { type: "raster-dem", tiles: ["https://openzenith.cyopsys.com/api/dem-tile/{z}/{x}/{y}"], encoding: "terrarium", tileSize: 256, maxzoom: 12, }); map.addLayer({ id: "hillshade", type: "hillshade", source: "terrain", exaggeration: 1.2, }); ``` ### CesiumJS ```javascript // Custom Terrarium terrain provider (included in OpenZenith globe page) viewer.terrainProvider = createTerrariumTerrainProvider(Cesium); ``` ### API Endpoint ```bash # Query elevation (no API key required) curl "https://openzenith.cyopsys.com/api/elevation?lat=40.7128&lon=-74.0060" # Get a tile curl "https://openzenith.cyopsys.com/api/dem-tile/8/217/151.png" -o tile.png # Health check curl "https://openzenith.cyopsys.com/api/dem-tile?health=1" ``` ## Verified Accuracy | Location | Expected | Measured | Error | |----------|----------|----------|-------| | Mt. Everest | 8,849m | 8,533m | 0.4% (30m resolution) | | Death Valley | -86m | -74m | Within 30m | | Denali | 6,190m | 6,164m | 0.4% | | Mariana Trench | -10,935m | -7,122m | GEBCO 450m limit | | Atlantic Ocean | -5,000m+ | -5,175m | Within 450m | ## Technical Details | Property | Value | |----------|-------| | Tile format | 256×256 RGB PNG | | Encoding | Terrarium | | Tile pyramid | Standard XYZ (Slippy Map) | | Vertical datum | WGS84 ellipsoidal | | Coordinate system | EPSG:4326 (WGS84) | | NoData | R=0, G=0, B=0 (decodes to NaN) | | Land accuracy | 3–7m RMSE (Copernicus GLO-30) | | Ocean accuracy | ~100m (GEBCO 2025 bathymetry) | ## Data Sources | Source | Resolution | Coverage | License | |--------|-----------|----------|---------| | Copernicus GLO-30 | 30 arc-sec (~30m) | Global land | ESA Open | | GEBCO 2025 | 15 arc-sec (~450m) | Global (land+ocean) | CC-BY 4.0 | ## Related - **[OpenZenith](https://openzenith.cyopsys.com)** — Free elevation API, 2D/3D maps, GIS sandbox - **[openzenith Python library](https://github.com/aliasfoxkde/OpenZenith/tree/main/openzenith)** — `pip install openzenith` - **[GitHub](https://github.com/aliasfoxkde/OpenZenith)** — Source code ## License [MIT](https://opensource.org/licenses/MIT) — Free for personal and commercial use. Source data retains its own license: Copernicus GLO-30 (ESA Open), GEBCO 2025 (CC-BY 4.0).