Minimal setup for Copernicus DEM dataset ? #84
-
Hello, I am trying to setup a tile server for the copernicus DEM dataset, here is the setup: from fastapi import FastAPI
from titiler.core.factory import TilerFactory
from rio_tiler_pds.copernicus.aws.dem import Dem30Reader
app = FastAPI(title="Copernicus DEM Tile Server")
# Use TilerFactory with the Dem30Reader
copernicus_tiler = TilerFactory(reader=Dem30Reader)
# Register the tile endpoint at /copernicus
app.include_router(copernicus_tiler.router, prefix="/copernicus", tags=["Copernicus DEM"]) The server starts well on port 8000 But when I try to read any tile or statistic, for example:
I get What am I doing wrong ? Sorry for the newbie question Thanks a lot Thibault |
Beta Was this translation helpful? Give feedback.
Answered by
vincentsarago
Jul 4, 2025
Replies: 1 comment 2 replies
-
There are few gotcha this this reader because it behaves like a mosaic reader from attrs import define
from fastapi import FastAPI
from titiler.core.factory import TilerFactory
from rio_tiler_pds.copernicus.aws.dem import Dem30Reader
app = FastAPI(title="Copernicus DEM Tile Server")
# NOTE: we need to overwrite the `path_dependency` for titiler (which will inject `url` queryparameter).
# The `Dem30Reader` doesn't take any input so we return nothing
def fake_path_dependency() -> None:
return
# We don't want to have `/statistics` endpoints (because it's unsupported by the reader)
@define(kw_only=True)
class CustomTilerFactory(TilerFactory):
def statistics(self):
"""We cannot return statistics for the `Dem30Reader`."""
return
# Use TilerFactory with the Dem30Reader
copernicus_tiler = CustomTilerFactory(
reader=Dem30Reader,
path_dependency=fake_path_dependency,
add_preview=False,
add_part=False,
router_prefix="/copernicus",
)
# Register the tile endpoint at /copernicus
app.include_router(copernicus_tiler.router, prefix="/copernicus", tags=["Copernicus DEM"]) ![]() http://127.0.0.1:8000/copernicus/WebMercatorQuad/map.html?rescale=0,1000&colormap_name=terrain |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
tdurand
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are few gotcha this this reader because it behaves like a mosaic reader