Often WMS servers will not give you anything but a transparent image at lower zooms. When using WMS servers on the web this can often lead to a poor user experience.

I would like to build a local cache of the missing lower level zooms of the remote WMS server, so that we can also display map tiles on the web when zoomed out. I do not control the remote server so we can assume it doesn't have any special features.

What is an easy way to pull down the lowest resolution available from the WMS and then building a pyramid of the missing lower zoom level raster tiles as static files (preferably .mbtiles)?

  • 1
    depends on the terms of service - if its a GeoServer you could just ask for the .mbtiles directly. In general you are describing a WMTS service
    – Ian Turton
    Jun 25, 2020 at 19:17
  • 1
    Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works.
    – Ian Turton
    Jun 25, 2020 at 19:18
  • 1
    A WMS has no concept of a zoom level, you control your own zoom levels by making requests where you specify the size of the map (in pixels) and the size of the bounding box. You won't be able to request mbtiles if the remote server doesn't offer / advertise them in the GetCapabilities response. You might want to look at solutions where you cascade the remote service through your own service (for example GeoServer and MapServer can do this), or otherwise proxy the remote service (MapProxy).
    – nmtoken
    Jul 3, 2020 at 8:30

1 Answer 1


One way of doing it (using MapProxy, as recommended by nmtoken, but not necessarily for proxying, just for downloading):

  • Open the WMS capabilities XML and look at the MinScaleDenominator value for the layer.
  • Convert the MinScaleDenominator value to zoom level using the table at https://wiki.openstreetmap.org/wiki/MinScaleDenominator
  • Get Mapproxy. I used the Docker image. Execute the mapproxy-seed command to seed tiles into a .mbtiles files specifying a single zoom level.
  • Use gdaladdo to build the missing overview zoom levels, then serve the tiles using any mbtiles capable web server.

Sample MapProxy configuration snippet:

  - name: mylayer
    sources: [mylayer_cache]
    type: wms
    url: <wms base url>
    layers: <wms layer name>
    sources: [mylayer]
    grids: [webmercator]
    type: mbtiles
    filename: mylayer.mbtiles
    caches: [mylayer_cache]
    levels: [5] # zoom level converted from MinScaleDenominator

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.