Skip to content

Commit dd740a7

Browse files
fix landing and update titiler (#9)
1 parent 016ae71 commit dd740a7

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

runtimes/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ classifiers = [
2525
]
2626
dynamic = ["version"]
2727
dependencies = [
28-
"titiler.xarray==0.19.2",
28+
"titiler.xarray==0.21.1",
2929
"fsspec",
3030
"h5netcdf",
3131
"zarr",

runtimes/titiler_md_demo/main.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""app."""
22

3-
import re
4-
53
import jinja2
64
import rasterio
75
from fastapi import FastAPI
@@ -10,14 +8,14 @@
108
from starlette.responses import HTMLResponse
119
from starlette.templating import Jinja2Templates
1210
from starlette_cramjam.middleware import CompressionMiddleware
11+
1312
from titiler.core import __version__ as titiler_version
1413
from titiler.core.errors import DEFAULT_STATUS_CODES, add_exception_handlers
1514
from titiler.core.factory import AlgorithmFactory, ColorMapFactory, TMSFactory
1615
from titiler.core.middleware import CacheControlMiddleware
1716
from titiler.xarray.extensions import VariablesExtension
1817
from titiler.xarray.factory import TilerFactory
1918

20-
2119
from .extensions import DimsExtension
2220
from .settings import ApiSettings
2321

@@ -39,13 +37,12 @@
3937

4038

4139
md = TilerFactory(
42-
router_prefix="/md",
4340
extensions=[
4441
VariablesExtension(),
4542
DimsExtension(),
4643
],
4744
)
48-
app.include_router(md.router, prefix="/md", tags=["Multi Dimensional"])
45+
app.include_router(md.router, tags=["Multi Dimensional"])
4946

5047
# TileMatrixSets endpoints
5148
app.include_router(TMSFactory().router, tags=["Tiling Schemes"])
@@ -136,12 +133,16 @@ def landing(request: Request):
136133
}
137134

138135
urlpath = request.url.path
139-
if root_path := request.app.root_path:
140-
urlpath = re.sub(r"^" + root_path, "", urlpath)
136+
if root_path := request.scope.get("root_path"):
137+
urlpath = urlpath.removeprefix(root_path)
138+
141139
crumbs = []
142140
baseurl = str(request.base_url).rstrip("/")
143141

144142
crumbpath = str(baseurl)
143+
if urlpath == "/":
144+
urlpath = ""
145+
145146
for crumb in urlpath.split("/"):
146147
crumbpath = crumbpath.rstrip("/")
147148
part = crumb
@@ -161,13 +162,10 @@ def landing(request: Request):
161162
"title": "TiTiler",
162163
},
163164
"crumbs": crumbs,
164-
"url": str(request.url),
165-
"baseurl": baseurl,
166-
"urlpath": str(request.url.path),
167-
"urlparams": str(request.url.query),
168165
},
169166
)
170167

168+
171169
@app.get(
172170
"/healthz",
173171
description="Health Check.",

0 commit comments

Comments
 (0)