This config took a while to get working for me. I needed to get this configuration in to mapproxy because I needed to reproject the tiles for the software I was using. from EPSG:3857 to webmercator style. This configuration will provide the legendary leisure maps for free thanks to the £1000 free api credits per month from the os data hub (THANK YOU). It also contains some of the other map styles.
To use this configuration you will first need an api key from https://osdatahub.os.uk/. Then replace snip with the api key within the sources section and you should be good to go.
Please ensure you use the tiles inline with the license.
Enjoy!
services:
demo:
tms:
use_grid_names: true
origin: nw
#wmts:
#wms:
# srs: ['EPSG:3857', 'EPSG:27700']
# md:
# title: iShare Base Maps
# abstract: OS Maps API base mapping
layers:
- name: osgb__osmaps_leisure_webmercator
title: OS Maps API Leisure
sources: [osgb__osmaps_leisure_webmercator__cache]
- name: osgb__osmaps_road_webmercator
title: OS Maps API Road
sources: [osgb__osmaps_road_webmercator__cache]
- name: osgb__osmaps_outdoor_webmercator
title: OS Maps API Outdoor
sources: [osgb__osmaps_outdoor_webmercator__cache]
- name: osgb__osmaps_light_webmercator
title: OS Maps API Light
sources: [osgb__osmaps_light_webmercator__cache]
caches:
osgb__osmaps_leisure_webmercator__cache:
grids: [webmercator]
sources: [osgb__osmaps_leisure_27700__cache]
meta_buffer: 0
minimize_meta_requests: true
cache:
type: file
directory: /mapproxy/cache/osmaps_leisure_webmercator
osgb__osmaps_leisure_27700__cache:
grids: [osgb__osmaps_epsg27700_leisure_premium__grid]
sources: [osgb__osmaps_leisure_27700__tiles]
meta_buffer: 0
minimize_meta_requests: true
disable_storage: true
cache:
type: file
directory: /mapproxy/cache/osmaps_leisure_epsg27700
osgb__osmaps_road_webmercator__cache:
grids: [webmercator]
sources: [osgb__osmaps_road_3857__tiles]
meta_buffer: 0
minimize_meta_requests: true
cache:
type: file
directory: /mapproxy/cache/osmaps_road_webmercator
osgb__osmaps_outdoor_webmercator__cache:
grids: [webmercator]
sources: [osgb__osmaps_outdoor_3857__tiles]
meta_buffer: 0
minimize_meta_requests: true
cache:
type: file
directory: /mapproxy/cache/osmaps_outdoor_webmercator
osgb__osmaps_light_webmercator__cache:
grids: [webmercator]
sources: [osgb__osmaps_light_3857__tiles]
meta_buffer: 0
minimize_meta_requests: true
cache:
type: file
directory: /mapproxy/cache/osmaps_light_webmercator
sources:
osgb__osmaps_leisure_27700__tiles:
type: tile
grid: osgb__osmaps_epsg27700_leisure_premium__grid
url: https://api.os.uk/maps/raster/v1/zxy/Leisure_27700/%(z)s/%(x)s/%(y)s.png?key=snip
osgb__osmaps_road_3857__tiles:
type: tile
grid: webmercator
url: https://api.os.uk/maps/raster/v1/zxy/Road_3857/%(z)s/%(x)s/%(y)s.png?key=snip
osgb__osmaps_outdoor_3857__tiles:
type: tile
grid: webmercator
url: https://api.os.uk/maps/raster/v1/zxy/Outdoor_3857/%(z)s/%(x)s/%(y)s.png?key=snip
osgb__osmaps_light_3857__tiles:
type: tile
grid: webmercator
url: https://api.os.uk/maps/raster/v1/zxy/Light_3857/%(z)s/%(x)s/%(y)s.png?key=snip
grids:
webmercator:
base: GLOBAL_WEBMERCATOR
# OS Maps API WMTS EPSG:27700 grid with full resolutions, used as
# a base for the other OS Maps API WMTS EPSG:27700 grids
osgb__osmaps_epsg27700_premium__grid:
origin: nw
srs: 'EPSG:27700'
bbox: [-238375.0000149319, 0.0, 900000.00000057, 1376256.0000176653]
bbox_srs: 'EPSG:27700'
res: [896.0, 448.0, 224.0, 112.0, 56.0, 28.0, 14.0, 7.0, 3.5, 1.75, 0.875, 0.4375, 0.21875, 0.109375]
# OS Maps API WMTS EPSG:27700 grid with resolutions for open data only
osgb__osmaps_epsg27700_open__grid:
base: osgb__osmaps_epsg27700_premium__grid
res: [896.0, 448.0, 224.0, 112.0, 56.0, 28.0, 14.0, 7.0, 3.5, 1.75]
# OS Maps API WMTS EPSG:27700 grid for Leisure premium and open data resolutions
osgb__osmaps_epsg27700_leisure_premium__grid:
base: osgb__osmaps_epsg27700_premium__grid
res: [896.0, 448.0, 224.0, 112.0, 56.0, 28.0, 14.0, 7.0, 3.5, 1.75]
# OS Maps API WMTS EPSG:27700 grid for Leisure open data resolutions
osgb__osmaps_epsg27700_leisure_open__grid:
base: osgb__osmaps_epsg27700_premium__grid
res: [896.0, 448.0, 224.0, 112.0, 56.0, 28.0]
Leave a Reply