Skip to content

Commit

Permalink
Merge pull request #2706 from camptocamp/backport/2704-to-1.18
Browse files Browse the repository at this point in the history
[Backport 1.18] Fix cache with dimensions + min_resolution_seed
  • Loading branch information
sbrunner authored Jan 20, 2025
2 parents 51b2d51 + 3feddf4 commit 19dfc77
Show file tree
Hide file tree
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
Expand Up @@ -89,10 +89,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]:
Expand Down
2 changes: 1 addition & 1 deletion tilecloud_chain/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,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:
Expand Down

0 comments on commit 19dfc77

Please sign in to comment.