Skip to content

Instantly share code, notes, and snippets.

@pedros007
Last active October 21, 2016 14:58
Show Gist options
  • Save pedros007/77cea2629d2388bc6d210cc9ab6b578d to your computer and use it in GitHub Desktop.
Save pedros007/77cea2629d2388bc6d210cc9ab6b578d to your computer and use it in GitHub Desktop.
Mapcache config to generate a cache from a WMS
<?xml version="1.0" encoding="UTF-8"?>
<!-- docs: http://mapserver.org/mapcache/config.html -->
<!-- see the accompanying mapcache.xml.sample for a fully commented configuration file -->
<!-- sample config: https://github.com/mapserver/mapcache/blob/master/mapcache.xml.sample -->
<!-- Mapcache docker image that can work with this: https://github.com/yjacolin/docker-mapcache/blob/master/Dockerfile -->
<mapcache>
<cache name="disk" type="disk">
<base>/tmp/tilecache</base>
<symlink_blank/>
</cache>
<source name="raster_layer" type="wms">
<getmap>
<params>
<FORMAT>image/png</FORMAT>
<LAYERS>raster_layer</LAYERS>
<MAP>/usr/src/mapfiles/mapfile.map</MAP>
</params>
</getmap>
<http>
<url>http://172.17.0.2:80/mapserv</url>
</http>
</source>
<grid name="dgWGS84">
<extent>-180 -90 180 90</extent>
<srs>EPSG:4326</srs>
<units>dd</units>
<size>306 306</size>
<!-- specify resolutions such that we get half-meter pixels at a particular zoomlevel. OpenLayers must match this! -->
<resolutions>1.176470588235294156831401 0.588235294117647078415700 0.294117647058823539207850 0.147058823529411769603925 0.073529411764705884801963 0.036764705882352942400981 0.018382352941176471200491 0.009191176470588235600245 0.004595588235294117800123 0.002297794117647058900061 0.001148897058823529450031 0.000574448529411764725015 0.000287224264705882362508 0.000143612132352941181254 0.000071806066176470590627 0.000035903033088235295313 0.000017951516544117647657 0.000008975758272058823828 0.000004487879136029411914 0.000002243939568014705957 0.000001121969784007352979 </resolutions>
</grid>
<tileset name="raster_layer">
<source>raster_layer</source>
<!--<cache>sqlite</cache>-->
<cache>disk</cache>
<grid minzoom="0" maxzoom="13">dgWGS84</grid>
<format>PNG</format>
<metatile>5 5</metatile>
<metabuffer>10</metabuffer>
<expires>3600</expires>
</tileset>
<default_format>PNG</default_format>
<service type="wms" enabled="true">
<full_wms>assemble</full_wms>
<resample_mode>bilinear</resample_mode>
<format>PNG</format>
<maxsize>4096</maxsize>
</service>
<service type="wmts" enabled="false"/>
<service type="tms" enabled="false"/>
<service type="kml" enabled="false"/>
<service type="gmaps" enabled="false"/>
<service type="ve" enabled="false"/>
<service type="mapguide" enabled="false"/>
<service type="demo" enabled="false"/>
<errors>report</errors>
<locker type="disk">
<directory>/tmp</directory>
<timeout>300</timeout>
</locker>
</mapcache>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment