diff --git a/mapcache/mapcache_template.xml b/mapcache/mapcache_template.xml index 122ff15f85a1e8004e81d8dccf3386b2b2244bfb..2a018806ea108c2b6c5c58a45cad50ee4b2c8cd3 100644 --- a/mapcache/mapcache_template.xml +++ b/mapcache/mapcache_template.xml @@ -198,22 +198,11 @@ <tileset name="{{ plat }}_abi_{{ sector }}_l1b_{{ product }}"> <source>{{ plat }}_abi_{{ sector }}_l1b_{{ product }}</source> <cache>disk</cache> - - <!-- grid: the "name" attribute of a preconfigured <grid> - you can also use the following notation to limit the area that will be cached and served to clients: - <grid restricted_extent="-10 40 10 50">WGS84</grid> - this way is better than using a grid with a limited extent, as in this way the tiles that are already - cached are not invalidated should you want to modify the restricted extent in the future. When using - the restricted_extent attribute, you should give the corresponding information to the client that will - be using the service. - you can also limit the zoom levels that are cached/accessible by using the minzoom, maxzoom attributes. - - - NOTE: when adding a <grid> element, you *MUST* make sure that the source you have selected is able to - return images in the grid's srs. - --> -<!-- <grid restricted_extent="-10 40 10 50" minzoom="6" maxzoom="8">WGS84</grid>--> - <grid>grid_{{ plat }}_abi_radf</grid> + {% if product in zoom_levels %} + <grid minzoom="{{ zoom_levels[product][0] }}" maxzoom="{{ zoom_levels[product][1] }}">grid_{{ plat }}_abi_radf</grid> + {% else %} + <grid>grid_{{ plat }}_abi_radf</grid> + {% endif %} <!-- metadata optional metadata tags used for responding to GetCapabilities request. @@ -257,6 +246,7 @@ <source>{{ plat }}_abi_basemap</source> <cache>disk</cache> <grid>grid_{{ plat }}_abi_radf</grid> +<!-- <grid minzoom="0" maxzoom="4">grid_{{ plat }}_abi_radf</grid>--> <metadata> <title>CSPP Geo Geo2Grid Web Viewer - {{ PLATFORM_LONG_NAMES[plat] }} ABI</title> <abstract>{{ PLATFORM_LONG_NAMES[plat] }} ABI Basemap tiles</abstract> diff --git a/mapcache/render.py b/mapcache/render.py index 242dfa0b747f494f1e69bf9875178203895cb173..9962da93dd5dd28a08a239ba68dda661d16fcb7a 100644 --- a/mapcache/render.py +++ b/mapcache/render.py @@ -55,6 +55,15 @@ IMAGE_FORMATS = defaultdict(lambda: 'rgba') # IMAGE_FORMATS['C{:02d}'.format(i)] = 'gray' +ZOOM_LEVELS = defaultdict(lambda: (0, 7)) +for ch_num in [4] + list(range(6, 17)): + ZOOM_LEVELS[f"C{ch_num:02d}"] = (0, 5) +ZOOM_LEVELS["C01"] = (0, 6) +ZOOM_LEVELS["C03"] = (0, 6) +ZOOM_LEVELS["C05"] = (0, 6) +ZOOM_LEVELS["C05"] = (0, 6) + + def main(): import argparse parser = argparse.ArgumentParser(description="Render mapcache template to complete mapcache config.") @@ -76,6 +85,7 @@ def main(): 'image_autoexpire': image_autoexpire, 'basemap_autoexpire': basemap_autoexpire, 'IMAGE_FORMATS': IMAGE_FORMATS, + 'zoom_levels': ZOOM_LEVELS, } with open(args.template_fn, 'r') as tmpl_file: