From a6fa1e2e211fef11dd52336f3d662dc0bb3426fa Mon Sep 17 00:00:00 2001 From: dnomadb Date: Fri, 13 May 2016 19:17:20 -0700 Subject: [PATCH] small fixes for smaller composite zooms --- untiler/__init__.py | 5 ++--- untiler/scripts/tile_utils.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/untiler/__init__.py b/untiler/__init__.py index 45813ed..39d2bef 100644 --- a/untiler/__init__.py +++ b/untiler/__init__.py @@ -148,7 +148,6 @@ def streaming_tile_worker(data): toFaux, frFaux = affaux(fDiff) if not globalArgs['no_fill']: - print('filling') ## Read and write the fill tiles first for t in subtiler.get_fill_super_tiles(superTiles, data['maxCovTiles'], fThresh): z, x, y = t @@ -219,7 +218,7 @@ def stream_dir(inputDir, outputDir, compositezoom, maxzoom, logdir, read_templat raise ValueError("No tiles were found for that template") if maxzoom: - allTiles = tiler.filter_tiles(allTiles, maxzoom) + allTiles = tiler.filter_tiles(allTiles, maxzoom, compositezoom) if allTiles.shape[0] == 0: raise ValueError("No tiles were found below that maxzoom") @@ -237,7 +236,7 @@ def stream_dir(inputDir, outputDir, compositezoom, maxzoom, logdir, read_templat 'logdir': logdir, 'creation_opts': creation_opts, 'no_fill': no_fill - })) + })) superTiles = tiler.get_super_tiles(allTiles, compositezoom) diff --git a/untiler/scripts/tile_utils.py b/untiler/scripts/tile_utils.py index 9a599a4..77cd04b 100644 --- a/untiler/scripts/tile_utils.py +++ b/untiler/scripts/tile_utils.py @@ -117,8 +117,8 @@ def get_sub_tiles(self, subTiles, superTiles): 'z': z }) - def filter_tiles(self, tiles, zoomfloor): - return tiles[np.where(tiles[:, 0] <= zoomfloor)] + def filter_tiles(self, tiles, zoomfloor, zoomceil): + return tiles[np.where((tiles[:, 0] <= zoomfloor) & (tiles[:, 0] >= zoomceil))] def get_fill_super_tiles(self, superTiles, fillTiles, fillThresh): for ct in ((np.all(superTiles == a, axis=1).sum(), a) for a in fillTiles): @@ -141,7 +141,7 @@ def parse_template(template): if pattern.match(template): valPattern = re.compile(r"{(z|x|y)}") filepath = re.compile(r"(jpg|png|tif)$") - sepmatch = re.compile(r"(?:{z})(/|-)(?:{x})(/|-)(?:{y})") + sepmatch = re.compile(r"(?:{z})(/|-|_)(?:{x})(/|-|_)(?:{y})") separator = sepmatch.findall(template)[0] if len(separator) != 2 or separator[0] != separator[1]: