Thursday, January 21, 2016

Offline Caching for decarta tiles

While developing a Geo mapping application recently, I found myself needing to work offline for extended periods of time. I needed a cache for the tiles and because someone other than me may need to configure this, so here is the solution that ended up using.

I turned to the excellent mapproxy.org. MapProxy is an open source proxy for geospatial data. It caches, accelerates and transforms data from existing map services and serves any desktop or web GIS client.

This is the config file I ended up using:

# mapproxy.yaml
services:
  demo:
  tms:
    use_grid_names: true

layers:
  - name: decarta
    title: Decarta WMS - api.decarta.com
    sources: [decarta_cache]

caches:
  decarta_cache:
    grids: [decarta]
    sources: [decarta_tms]
    format: image/png

sources:
  decarta_tms:
    type: tile
    grid: decarta
    url: http://api.decarta.com/v1/%(key)/tile/%(x)s/%(y)s/%(z)s.png

grids:
  decarta:
    base: GLOBAL_MERCATOR
    srs: EPSG:3857

globals:



Taking it for a spin


$ mapproxy-util serve-develop mapproxy.yaml
 

No comments: