[MapProxy] Merging 3 sources for different scale levels as a single service

Just van den Broecke just at justobjects.nl
Fri Aug 25 05:37:26 PDT 2017


Hi,

I just did almost the same, though with 2 sources and without 
cache-storage. After quite some fiddling with configs, it worked by 
playing with min_res, max_res and transparency on the source-level.
Keep the grid defs as is (GLOBAL_WEBMERCATOR in your case). Tiles are 
here only requested from 1 TMS remote source at a time, otherwise a 
transparent png is returned by source locally, my config-sketch:

layers:
   - name: combilayer
     title: combined topo..
     sources: [combi_cache]

caches:
   combi_cache:
     grids: [dutch_grid]
     disable_storage: true
     sources: [source1, source2]
     format: image/png
     meta_buffer: 0

sources:
   source1:
     type: tile
     url: URL1..%(tms_path)s.png
     transparent: true
     grid: dutch_grid
     max_res: 0.84

   source2:
     type: tile
     url: URL2..%(tms_path)s.png
     transparent: true
     grid: dutch_grid
     min_res: 0.84

grids:
   dutch_grid:
     tile_size: [256, 256]
     srs: 'EPSG:28992'
     bbox: [-285401.920, 22598.080, 595401.920, 903401.920]
     bbox_srs: 'EPSG:28992'
     res: [3440.64, 1720.32, 860.16, 430.08, 215.04, 107.52, 53.76, 
26.88, 13.44, 6.72, 3.36, 1.68, 0.84, 0.42, 0.21, 0.105, 0.0525]

etc, no specific grid definitions. Though with 3 layers you have to play 
with min_res and max_res for the "middle" scale 1:250. Somehow I got 
errors "min_res > "max_res" when both specified on source. Looks like 
they need to be reversed? Maybe others can fill in here.

Best,

Just van den Broecke

On 25-08-17 02:06, Josh Norton wrote:
> Hi there,
>
> I'm wanting to merge 3 tiled sources into a single tiled service as below:
>
> Global topo service for levels 0-7
> Country 1:250k service for levels 8-12 (rendering the global tiles in
> areas outside the country covered)
> Country 1:50k service for levels 13- (rendering the global tiles for
> areas outside the country covered)
>
> I have been able to merge the first 2 services where the country 250k
> renders on top of the global service but I am unable to control the
> scale that the 250k or 50k tiles start to render.
> I have tried specifying a set resolution list, setting min_res and
> max_res, num_levels etc
>
> A working configuration file is below with some options commented out in
> the grid section that do not produce the desired results.
> Grateful for any help anyone can offer.
>
> Josh
>
>
> /services:/
> /  demo:/
> /  tms:/
> /  wmts:/
> /    restful: true/
> /    kvp: true/
> /
> /
> /layers:/
> /
> /
> /-   name: Topo/
> /    title: Topo/
> /    sources: [topo_cache_gpk]/
> /
> /
> /-   name: LINZtopo50/
> /    title: LINZ Topo 50/
> /    sources: [linz_topo50_cache_gpk]/
> /
> /
> /-   name: LINZtopo250/
> /    title: LINZ Topo 250/
> /    sources: [linz_topo250_cache_gpk]/
> /    /
> /caches:/
> /
> /
> /  topo_cache_gpk:/
> /    sources: [topo_esri_source, linz_topo250_source]/
> /    grids: [GLOBAL_WEBMERCATOR]/
> /    cache:/
> /      type: geopackage/
> /      filename: /opt/mapproxy/cache_data/topo_tiles.gpk/
> /      table_name: topo/
> /
> /
> /  topo_esri_cache_gpk:/
> /    sources: [topo_esri_source]/
> /    grids: [GLOBAL_WEBMERCATOR]/
> /    cache:/
> /      type: geopackage/
> /      filename: /opt/mapproxy/cache_data/topo_esri_tiles.gpk/
> /      table_name: topo_esri/
> /
> /
> /  linz_topo50_cache_gpk:/
> /    sources: [linz_topo50_source]/
> /    grids: [GLOBAL_WEBMERCATOR]/
> /    cache:/
> /      type: geopackage/
> /      filename: /opt/mapproxy/cache_data/LINZ_topo50_tiles.gpk/
> /      table_name: linz_topo50/
> /      /
> /  linz_topo250_cache_gpk:/
> /    sources: [linz_topo250_source]/
> /    grids: [GLOBAL_WEBMERCATOR]/
> /    cache:/
> /      type: geopackage/
> /      filename: /opt/mapproxy/cache_data/LINZ_topo250_tiles.gpk/
> /      table_name: linz_topo250/
> /
> /
> /sources:/
> /  topo_esri_source:/
> /    type: tile/
> /    grid: GLOBAL_WEBMERCATOR/
> /    url:
> http://10.0.0.232:6080/arcgis/rest/services/Topo/MapServer/tile/%(z)s/%(y)s/%(x)s
> <http://10.0.0.232:6080/arcgis/rest/services/Topo/MapServer/tile/%(z)s/%(y)s/%(x)s>/
> /
> /
> /  linz_topo50_source:/
> /    type: tile/
> /    transparent: true/
> /    grid: 'topo50grid'/
> /    url:
> http://tiles-a.data-cdn.linz.govt.nz/services;key=dd53dc504e3b4c37a627fa41a74ffd2b/tiles/v4/layer=2343/EPSG:3857/%(z)s/%(x)s/%(y)s.png
> <http://tiles-a.data-cdn.linz.govt.nz/services;key=dd53dc504e3b4c37a627fa41a74ffd2b/tiles/v4/layer=2343/EPSG:3857/%(z)s/%(x)s/%(y)s.png>/
> /  /
> /  linz_topo250_source:/
> /    type: tile/
> /    transparent: true/
> /    grid: 'topo250grid'/
> /    url:
> http://tiles-a.data-cdn.linz.govt.nz/services;key=dd53dc504e3b4c37a627fa41a74ffd2b/tiles/v4/layer=2324/EPSG:3857/%(z)s/%(x)s/%(y)s.png
> <http://tiles-a.data-cdn.linz.govt.nz/services;key=dd53dc504e3b4c37a627fa41a74ffd2b/tiles/v4/layer=2324/EPSG:3857/%(z)s/%(x)s/%(y)s.png>/
> /
> /
> /grids:/
> /  topo250grid:/
> /    base: GLOBAL_WEBMERCATOR/
> /    #num_levels: 6/
> /    #max_res: 4891.96981025128/
> /    #res: [611.49622628141, 305.748113140705, 152.8740565703525,
> 76.43702828517625, 38.21851414258813, 19.109257071294063]/
> /  topo50grid:/
> /    base: GLOBAL_WEBMERCATOR/
> /    #res: [9.554628535647032, 4.777314267823516, 2.388657133911758,
> 1.194328566955879, 0.5971642834779395, 0.29858214173896974]    /
> /
> /
> /# globals:/
> /#   image:/
> /#     formats:/
> /#       default_format:/
> /#         format: image/png/
> /#         colors: 0/
> /#         resampling_method: bilinear/
>
>
>
>
>
> _______________________________________________
> MapProxy mailing list
> MapProxy at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapproxy
>




More information about the MapProxy mailing list