Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update custom tms code example #771

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions docs/src/examples/code/tiler_with_custom_tms.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ from pyproj import CRS
EPSG6933 = TileMatrixSet.custom(
(-17357881.81713629, -7324184.56362408, 17357881.81713629, 7324184.56362408),
CRS.from_epsg(6933),
identifier="EPSG6933",
id="EPSG6933",
matrix_scale=[1, 1],
)

# 2. Register TMS
tms = tms.register([EPSG6933])
tms = tms.register({EPSG6933.id:EPSG6933})

tms = TMSFactory(supported_tms=tms)
cog = TilerFactory(supported_tms=tms)
tms_factory = TMSFactory(supported_tms=tms)
cog_factory = TilerFactory(supported_tms=tms)
```

2 - Create app and register our custom endpoints
Expand All @@ -44,11 +43,11 @@ from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers

from fastapi import FastAPI

from .routes import cog, tms
from .routes import cog_factory, tms_factory

app = FastAPI(title="My simple app with custom TMS")

app.include_router(cog.router, tags=["Cloud Optimized GeoTIFF"])
app.include_router(tms.router, tags=["Tiling Schemes"])
app.include_router(cog_factory.router, tags=["Cloud Optimized GeoTIFF"])
app.include_router(tms_factory.router, tags=["Tiling Schemes"])
add_exception_handlers(app, DEFAULT_STATUS_CODES)
```
Loading