mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 19:01:08 +00:00
feat[rio-pmtiles]: allow min and/or max zoom to be omitted when specifying zoom levels (#623)
* Allow min and/or max zoom to be omitted when specifying zoom levels * Fix help message for `--zoom-levels` * Add tests
This commit is contained in:
@@ -75,7 +75,8 @@ def test_export_tiles(tmpdir, data):
|
||||
src = MmapSource(f)
|
||||
assert len(list(all_tiles(src))) == 19
|
||||
|
||||
def test_export_zoom(tmpdir, data):
|
||||
|
||||
def test_export_zoom_both(tmpdir, data):
|
||||
inputfile = str(data.join("RGB.byte.tif"))
|
||||
outputfile = str(tmpdir.join("export.pmtiles"))
|
||||
runner = CliRunner()
|
||||
@@ -88,6 +89,46 @@ def test_export_zoom(tmpdir, data):
|
||||
src = MmapSource(f)
|
||||
assert len(list(all_tiles(src))) == 6
|
||||
|
||||
def test_export_zoom_neither(tmpdir, data):
|
||||
inputfile = str(data.join("RGB.byte.tif"))
|
||||
outputfile = str(tmpdir.join("export.pmtiles"))
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
main_group, ["pmtiles", inputfile, outputfile, "--zoom-levels", ".."]
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
||||
with open(outputfile, "rb") as f:
|
||||
src = MmapSource(f)
|
||||
assert len(list(all_tiles(src))) == 19
|
||||
|
||||
def test_export_zoom_only_min(tmpdir, data):
|
||||
inputfile = str(data.join("RGB.byte.tif"))
|
||||
outputfile = str(tmpdir.join("export.pmtiles"))
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
main_group, ["pmtiles", inputfile, outputfile, "--zoom-levels", "6.."]
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
||||
with open(outputfile, "rb") as f:
|
||||
src = MmapSource(f)
|
||||
assert len(list(all_tiles(src))) == 12
|
||||
|
||||
def test_export_zoom_only_max(tmpdir, data):
|
||||
inputfile = str(data.join("RGB.byte.tif"))
|
||||
outputfile = str(tmpdir.join("export.pmtiles"))
|
||||
runner = CliRunner()
|
||||
result = runner.invoke(
|
||||
main_group, ["pmtiles", inputfile, outputfile, "--zoom-levels", "..7"]
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
|
||||
with open(outputfile, "rb") as f:
|
||||
src = MmapSource(f)
|
||||
assert len(list(all_tiles(src))) == 13
|
||||
|
||||
|
||||
def test_export_jobs(tmpdir, data):
|
||||
inputfile = str(data.join("RGB.byte.tif"))
|
||||
outputfile = str(tmpdir.join("export.pmtiles"))
|
||||
|
||||
Reference in New Issue
Block a user