Skip to content

Conversation

@vincentsarago
Copy link
Member

This PR sketch out a simple / custom TiTiler for VBOS

Screenshot 2025-10-28 at 22 33 32

Comment on lines +73 to +89
###############################################################################
# TiTiler endpoints
def DatasetPathParams(
dataset_id: Annotated[
Literal["coral", "other"],
Path(description="Dataset"),
],
year: Annotated[int, Path(description="Year")],
) -> str:
"""Custom Dataset Path Parameter which define dataset_id and year PATH parameter and return a VRT url."""
name: str
if dataset_id == "coral":
name = "nbgi_clipped"
elif dataset_id == "other":
raise HTTPException(status_code=404, detail="Not Found.")

return f"https://syd1.digitaloceanspaces.com/mis-geotiff-storage/production/raster/{name}_{year}.vrt"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

This part needs to be updated once we have the VRT created

templates=titiler_templates,
router_prefix="/dataset/{dataset_id}/years/{year}",
)
app.include_router(tiler.router, prefix="/dataset/{dataset_id}/years/{year}")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small titiler hack, we use a special notation for the endpoint prefix /dataset/{dataset_id}/years/{year}. This will tell FastAPI to look for Path parameters (define in our custom DatasetPathParams)

@vincentsarago vincentsarago changed the title sketch custom tiler [DO NOT MERGE] sketch custom tiler Oct 28, 2025
validators=[
FileExtensionValidator(
allowed_extensions=["tiff", "tif", "geotiff", "gtiff"]
allowed_extensions=["tiff", "tif", "geotiff", "gtiff", "vrt"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@willemarcel, could you take a look here and see if this is correct? I thought just adding the vrt extension here and running python manage.py makemigrations + redeploying should work, but the backend is still not accepting .vrt file uploads. Am I missing a step somewhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants