Build a mapcache configuration from capabilities

Example of parsing a WMS capabilities from WMS data source, (licence : environnement Canada) to build a mapcache.xml configuration file for Mapcache (tile WMTS server).

The example build a mapcache tileset for a couple (layer,style).
Everyone is free to use or reproduce any information contained on this website.
Processing is provided as an example, the creator assumes no responsibility for any loss or damage caused by software and related codes.
The objective is to provide an example of a WMS capabilities processing.
The parameters used and the design are in no way a recommendation. Above defined rules used are :

  • mapacache.source
    • .name = SOURCE + "_" + WMS.layer.name + "_" + WMS.style.name
    • .getmap.params.
      • .FORMAT = image/png
      • .LAYERS = WMS.layer.name
      • .STYLES = WMS.style.name
  • mapacache.tileset
    • .name = WMS.layer.name + "_" + WMS.style.name
    • .source = SOURCE + "_" + WMS.layer.name + "_" + WMS.style.name
    • .dimensions.dimension
      • .name="elevation"
      • .type = regex
      • value=.*
      • .name="time"
      • .type = regex
      • value=.*
    • .cache = disk
    • .format = PNG
    • .grid = WGS84 : predefined grid in mapcache
      .grid = GoogleMapsCompatible : predefined grid in mapcache
    • .metatile = 5 5
    • .metabuffer = 10

See the mapcache.js source and WMSCapabilities.xml file to see how this is done.