5

I have a functioning mapserver installation runing on Ubuntu 14.04 and it's working fine. However, I would like to up the performance by putting mapcache in front of it.

I've installed mapcache, but I can't seem to create a valid mapcache.xml file.

I've found a number of 'complete' examples online, but I'm having trouble wrapping my head around all of the details.

Can someone point me to a minimal mapcache.xml file that simply forwards GetMap requests to mapserver and caches the resulting tiles?

That would at least help get me started.

7
  • I second this post, I've been also looking for a simple example to do this, I want to use CGI directly.
    – Gery
    Commented May 30, 2015 at 23:18
  • And not through WMS? Does WMS already work for you with the mapcache.xml that comes with the sources?
    – user30184
    Commented Jun 1, 2015 at 10:58
  • well, I think it could be through WMS, the problem if I'm right is that through WMS I would have to add all the details of my WMS layers in the mapcache.xml, and using CGI would be simpler (ie. mapcache fetches all layers details directly from the main MAP file), am I right? does it work that way?
    – Gery
    Commented Jun 1, 2015 at 20:27
  • So where do you stand now? Have you had a try with the demo configuration that installs by default and is also available from github.com/mapserver/mapcache/blob/master/mapcache.xml?
    – user30184
    Commented Jun 3, 2015 at 8:57
  • 1
    The direct use of mapfile is still undocumented as in lists.osgeo.org/pipermail/mapserver-users/2013-September/… and I think it is an experimental feature and need to be activated when building mapcache. Have you made your own build from the sources and with the USE_MAPSERVER flag? Otherwise I fear that you are wasting your time.
    – user30184
    Commented Jun 3, 2015 at 9:08

1 Answer 1

2

If you want to cache tiles from the backend WMS without having to know the layer names beforehand use either "combined_mirror" or "split_mirror" mode.

This doesn't seem to be properly documented, but it is mentioned in this issue

"combined_mirror" makes a tileset for each combination of layers encountered. "split_mirror" will make a tileset for each layer and then assemble these tiles.

The configuration shown in the issue (note "combined_mirror" and no wms layers defined):

<?xml version="1.0" encoding="UTF-8"?>

<mapcache mode="combined_mirror">
   <cache name="disk" type="disk">
      <base>/tmp</base>
      <symlink_blank/>
   </cache>

   <source name="vmap0" type="wms">
      <getmap>
         <params>
            <FORMAT>image/jpeg</FORMAT>
         </params>
      </getmap>

      <http>
         <url>http://www2.dmsolutions.ca/cgi-bin/mswms_gmap</url>
      </http>
   </source>

   <tileset name="mirror">
      <source>vmap0</source>
      <cache>disk</cache>
      <grid>WGS84</grid>
      <grid>g</grid>
      <format>JPEG</format>
      <metatile>5 5</metatile>
      <metabuffer>10</metabuffer>
      <expires>3600</expires>
   </tileset>


   <default_format>JPEG</default_format>

   <service type="wms" enabled="true">
      <full_wms>assemble</full_wms>
      <resample_mode>bilinear</resample_mode>
      <format>JPEG</format>
      <maxsize>4096</maxsize>
      <forwarding_rule name="catch all">
            <http>
               <url>http://www2.dmsolutions.ca/cgi-bin/mswms_gmap</url>
            </http>
      </forwarding_rule>
   </service>
   <service type="wmts" enabled="true"/>
   <service type="tms" enabled="true"/>
   <service type="kml" enabled="true"/>
   <service type="gmaps" enabled="true"/>
   <service type="ve" enabled="true"/>
   <service type="demo" enabled="true"/>

   <errors>report</errors>
   <lock_dir>/tmp</lock_dir>

</mapcache>
0

Your Answer

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

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