CoolFace
Apppublic

canopyboard/chm-titiler

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

Canopyboard CHM titiler

A titiler tile server (deployed as a Docker Hugging Face Space) that serves the 1 m Canopy Height Model COGs — as one seamless mosaic of all tiles, and per-tile via STAC.

The COGs live in the public dataset repo `canopyboard/canopyboard-chm-sample`; titiler reads each over HTTPS range requests (/vsicurl/) and reprojects the native-UTM raster to WebMercator on the fly.

The STAC catalog + MosaicJSON are served by this Space under /data/ (see app.py). They are served same-origin on purpose: titiler's document fetcher (httpx) does not follow HF's resolve/main 307 redirect, so the catalog/mosaic JSON must be fetched from a non-redirecting origin. (The COGs are unaffected — GDAL follows redirects.) The canonical copies also live in the dataset repo under stac/ and mosaic/ for discovery.

CHM heights are float32 meters with NaN nodata, so always pass rescale=0,40 (use 0,50 for tall forest) and a colormap_name; NaN pixels render transparent automatically.

Below, SPACE = https://canopyboard-chm-titiler.hf.space.

See ALL tiles at once (seamless mosaic)

MOSAIC = SPACE/data/mosaic/chm-1m-eba.json

  • —Interactive map: SPACE/mosaicjson/WebMercatorQuad/map.html?url=MOSAIC&rescale=0,40&colormap_name=viridis
  • —XYZ tiles: SPACE/mosaicjson/tiles/WebMercatorQuad/{z}/{x}/{y}?url=MOSAIC&rescale=0,40&colormap_name=viridis
  • —TileJSON: SPACE/mosaicjson/WebMercatorQuad/tilejson.json?url=MOSAIC&rescale=0,40&colormap_name=viridis

Single tile (STAC)

ITEM = SPACE/data/stac/chm-1m-eba/<stem>/<stem>.json

  • —Viewer: SPACE/stac/viewer?url=ITEM&assets=chm&rescale=0,40&colormap_name=viridis
  • —XYZ tiles: SPACE/stac/tiles/WebMercatorQuad/{z}/{x}/{y}?url=ITEM&assets=chm&rescale=0,40&colormap_name=viridis
  • —Info (incl. bounds): SPACE/stac/info?url=ITEM&assets=chm

Private dataset repo (fallback)

The sample repo is public, so titiler needs no credentials. If the dataset repo is made private instead, add a Space secret HF_TOKEN and set in the Dockerfile:

dockerfile
ENV GDAL_HTTP_HEADERS="Authorization: Bearer ${HF_TOKEN}"

Local test

bash
pip install -r requirements.txt
uvicorn app:app --port 8000   # serves /data/ static + titiler routers
# then open http://localhost:8000/mosaicjson/WebMercatorQuad/map.html?url=http://localhost:8000/data/mosaic/chm-1m-eba.json&rescale=0,40&colormap_name=viridis