[GIS] How to configure MapProxy to show only cache

cachemapproxy

I have local files of the already built cache. Now I try to configure a layers which gets the cache layer and shows it, but the problem is that I can't make it ignore the original "sources" because it always asks me to specify the source and I don't want it to try get new layers from the server.

layers:
  - name: Earth
    title: EarthA
    sources: [eartch_cache]
caches:
  earth_cache:
    grids:[gm_flat]
    sources: []  #<- I can't do this, although I want something like that

globals:
 cache:
   base_dir: S:\CACHCE

It's not the whole configuration but its the important parts…

Is there any way to make MapProxy work with only cache?

I'm not familiar with MapProxy.

Best Answer

Leaving the sources array empty is allowed when you specify an explicit cache property. The following example uses an mbtiles cache, but any cache format should work:

caches:
  local_only:
    grids: [GLOBAL_MERCATOR]
    sources: []
    cache:
      type: mbtiles

When you use the local_only cache in a layer, it will load its data from cache_data/local_only.mbtiles only.

I tested this with MapProxy 1.8.2, but I was unable to find the matching entry in the change log, so I don't know what the first version is that supports this feature.

Update

I just found the following statement in the caches/mbtiles section in the docs:

You can set the sources to an empty list, if you use an existing MBTiles file and do not have a source.

Now that version 1.13.0 is out, this applies to additional cache types, such as geopackage files and s3 sources. So the quote above does not mean it can only be done with mbtiles exclusively.

Related Question