Skip to content

Commit

Permalink
Merge pull request #2705 from camptocamp/backport/2704-to-master
Browse files Browse the repository at this point in the history
[Backport master] Fix cache with dimensions + min_resolution_seed
sbrunner authored Jan 20, 2025
2 parents 3fb9680 + d5b113e commit ad5d844
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions tilecloud_chain/internal_mapcache.py
Original file line number Diff line number Diff line change
@@ -113,10 +113,15 @@ def delete_one(self, tile: Tile) -> Tile:
return tile

def _get_key(self, tile: Tile) -> str:
return (
f"{self._prefix}_{tile.metadata['config_file']}_{tile.metadata['layer']}_"
f"{tile.tilecoord.z}_{tile.tilecoord.x}_{tile.tilecoord.y}"
)
keys = [
self._prefix,
tile.metadata["config_file"],
tile.metadata["layer"],
tile.tilecoord.z,
tile.tilecoord.x,
tile.tilecoord.y,
] + [value for key, value in tile.metadata.items() if key.startswith("dimension_")]
return "_".join([str(key) for key in keys])

@contextlib.contextmanager
def lock(self, tile: Tile) -> Iterator[None]:
2 changes: 1 addition & 1 deletion tilecloud_chain/server.py
Original file line number Diff line number Diff line change
@@ -248,7 +248,7 @@ def get_max_zoom_seed(config: tilecloud_chain.DatedConfig, layer_name: str) -> i
if "min_resolution_seed" in layer:
max_zoom_seed = -1
for zoom, resolution in enumerate(config.config["grids"][layer["grid"]]["resolutions"]):
if resolution > layer["min_resolution_seed"]:
if resolution >= layer["min_resolution_seed"]:
max_zoom_seed = zoom
return max_zoom_seed
else:

0 comments on commit ad5d844

Please sign in to comment.