Skip to content

Commit 0d1c6aa

Browse files
committed
fix and add support in viz
1 parent 07c0d56 commit 0d1c6aa

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.15.0 (2025-02-26)
2+
3+
* add support for `VSIFile` backend (https://github.com/developmentseed/tilebench/pull/27)
4+
15
## 0.14.0 (2025-01-06)
26

37
* remove `python 3.8` support

tilebench/scripts/cli.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,14 @@ def random(input, zoom, reader, tms, reader_params):
323323
callback=options_to_dict,
324324
help="Reader Options.",
325325
)
326-
def viz(src_path, port, host, server_only, reader, config, reader_params):
326+
@click.option(
327+
"--io",
328+
"io_backend",
329+
type=click.Choice(["vsifile", "rasterio"], case_sensitive=True),
330+
help="IO Backend Options.",
331+
default="rasterio",
332+
)
333+
def viz(src_path, port, host, server_only, reader, config, reader_params, io_backend):
327334
"""WEB UI to visualize VSI statistics for a web mercator tile requests."""
328335
if reader:
329336
module, classname = reader.rsplit(".", 1)
@@ -342,6 +349,7 @@ def viz(src_path, port, host, server_only, reader, config, reader_params):
342349
port=port,
343350
host=host,
344351
config=config,
352+
io_backend=io_backend,
345353
)
346354
if not server_only:
347355
click.echo(f"Viewer started at {application.template_url}", err=True)

tilebench/viz.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ class TileDebug:
131131
port: int = attr.ib(default=8080)
132132
host: str = attr.ib(default="127.0.0.1")
133133
config: Dict = attr.ib(default=dict)
134+
io_backend: str = attr.ib(default="rasterio")
134135

135136
router: Optional[APIRouter] = attr.ib(init=False)
136137

@@ -215,6 +216,7 @@ def tile(
215216
add_to_return=True,
216217
raw=False,
217218
config=self.config,
219+
io=self.io_backend,
218220
)
219221
def _read_tile(src_path: str, x: int, y: int, z: int):
220222
with self.reader(src_path, **self.reader_params) as src_dst:
@@ -295,10 +297,10 @@ def info():
295297
}
296298
]
297299

298-
try:
299-
ovr = src_dst.dataset.overviews(1)
300-
except Exception:
301-
ovr = []
300+
try:
301+
ovr = src_dst.dataset.overviews(1)
302+
except Exception:
303+
ovr = []
302304

303305
info["overviews"] = len(ovr)
304306

0 commit comments

Comments
 (0)