Skip to content
Draft
Show file tree
Hide file tree
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
37 changes: 23 additions & 14 deletions rio_viz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def register_middleware(self):
allow_methods=["GET"],
allow_headers=["*"],
)
self.app.add_middleware(CacheControlMiddleware, cachecontrol="no-cache")
self.app.add_middleware(CacheControlMiddleware, cachecontrol="no-store")

def _update_params(self, src_dst, options: Type[DefaultDependency]):
"""Create Reader options."""
Expand Down Expand Up @@ -796,19 +796,28 @@ def viewer(request: Request):
elif self.reader_type == "assets":
name = "assets.html"

return templates.TemplateResponse(
request,
name=name,
context={
"tilejson_endpoint": str(request.url_for("tilejson")),
"stats_endpoint": str(request.url_for("statistics")),
"info_endpoint": str(request.url_for("info_geojson")),
"point_endpoint": str(request.url_for("point")),
"allow_3d": has_mvt,
"geojson": self.geojson,
},
media_type="text/html",
)
with self.reader(self.src_path, **self.reader_params) as src_dst: # type: ignore
return templates.TemplateResponse(
request,
name=name,
context={
"tiles_endpoint": str(
request.url_for("tile", z="{z}", x="{x}", y="{y}")
),
"stats_endpoint": str(request.url_for("statistics")),
"info_endpoint": str(request.url_for("info_geojson")),
"point_endpoint": str(request.url_for("point")),
"minzoom": self.minzoom
if self.minzoom is not None
else src_dst.minzoom,
"maxzoom": self.maxzoom
if self.maxzoom is not None
else src_dst.maxzoom,
"allow_3d": has_mvt,
"geojson": self.geojson or "undefined",
},
media_type="text/html",
)

@property
def endpoint(self) -> str:
Expand Down
Loading
Loading