Skip to content
shiftbloom-studioPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Elevation by shiftbloom studio.

An MIT-licensed elevation API and interactive map explorer. Query a latitude and longitude for the bare-earth elevation in metres. The initial dataset is Austria’s 1 m BEV terrain model from Mapterhorn.

Production target · elevation.shiftbloom.studio/api

API contract · API, load testing and costs

curl "https://elevation.shiftbloom.studio/api/elevation?lat=48.2082&lon=16.3738"
curl "https://elevation.shiftbloom.studio/api/elevation" \
  -H "Content-Type: application/json" \
  -d '{"locations":[{"latitude":48.2082,"longitude":16.3738},{"latitude":47.2692,"longitude":11.4041}]}'

A batch accepts up to 32 locations and returns results in input order. A gap in coverage returns NO_DATA for that location. An unavailable release returns 503.

Run the Vienna sample

Use Node.js 22.12 or newer and a Python environment that supports the pinned NumPy and Rasterio wheels. The sample reads only the needed byte ranges from Mapterhorn’s original archive and seeds the local Workers R2 emulator. It covers central Vienna on the same grid as the national release.

npm ci
python -m pip install -r scripts/data/requirements.txt
python scripts/data/import_at1.py sample
npm run seed:local -- .data/at1-vienna-sample-v1
npm run dev -- --var DATASET_RELEASE:at1-vienna-sample-v1

Open the local explorer or call the local Vienna lookup.

npm run check
npm test
npm audit --audit-level=moderate

Publish Austria to Cloudflare

Use a Workers Paid account with an active shiftbloom.studio zone. The Worker elevation, the private R2 bucket elevation-at and the custom domain elevation.shiftbloom.studio are provisioned in the account. Configure an rclone S3 remote named elevation with an R2 API token scoped to that bucket. The read-only lookup path uses an R2 binding, with no public bucket URL or S3 credentials in the Worker.

Run the Deploy Elevation GitHub Actions workflow on main to deploy with the repository's scoped credentials. Select sample to start the service with the Vienna sample while the Austria-wide import is being prepared. Select national once the importer has published the complete release to R2. The workflow verifies a live point lookup and batch at the custom domain.

Wrangler authenticates with an account API token scoped to the elevation Worker, since wrangler login does not support Worker-scoped permissions. Keep both values out of the repository. The custom domain is managed in the Cloudflare dashboard, so wrangler.jsonc has no routes and a deploy leaves the domain unchanged.

export CLOUDFLARE_API_TOKEN=<worker-scoped-api-token>
export CLOUDFLARE_ACCOUNT_ID=<account-id>
python scripts/data/import_at1.py download
python scripts/data/import_at1.py national
python scripts/data/import_at1.py publish .data/at1-2025-v1 --archive .data/source/at1.tar --remote elevation:elevation-at
npm run deploy

The archive alone is 109.5 GiB. Keep space for the derived blocks as well. The publisher preserves the original archive, verifies the derived objects and writes the manifest last. Use a fresh release ID for any change to the source, layout or encoding, and update DATASET_RELEASE in wrangler.jsonc as part of the rollout. Activate the new release only after its manifest is present and retain the prior prefix for rollback. Importer and object format

Data and architecture

The source is Mapterhorn's at1 GeoTIFF archive, which contains its normalized copy of the BEV release of 15 September 2024. The API looks up the nearest cell on the native EPSG:3035 grid, preserves the source heights in EPSG:9274 and reports them in metres rounded to two decimal places. The WGS 84 input is treated as ETRS89 for this lookup. BEV gives ±0.50 m as the typical height accuracy and notes that errors can be higher in alpine terrain. Mapterhorn source catalog · BEV product specification

The lookup core depends on a small storage interface. The Worker reads immutable, versioned Float32 blocks from private R2, uses a bounded isolate cache and a per-location Cloudflare cache, and groups batch points that share a block. It caps concurrent block reads in each request. The browser uses MapLibre GL with OpenFreeMap and makes API calls directly to the Worker. Cloudflare's static assets runtime delivers the application files. The core and file format can be reused by a future self-hosted server or npm package.

Credits

Terrain © Bundesamt für Eich- und Vermessungswesen (BEV), via Mapterhorn, CC BY 4.0. Elevation repackages the raster into lookup blocks. Mapterhorn source attribution · CC BY 4.0

Basemap from OpenFreeMap, using OpenMapTiles and data © OpenStreetMap contributors. OpenFreeMap · OpenStreetMap copyright

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages