[mapserver-users] mapcache config confusion

Stephen Woodbridge woodbri at swoodbridge.com
Fri Aug 30 16:05:10 PDT 2013


OK, so I have not tried this but here is what I think you need to do.

Turn off the mod-rewrite for this the mapcache urls as they are probably 
messing things up and they are not needed.

Both mapcache and mod-rewrite are trying to act on the same requests and 
this is probably not working.

in Mapcache your url is already simplified from the user point of view 
and in the xml you need to express the correct urls for mapserver to do 
its job (the user will never see these). Mapcache will take the tile 
request and server the tile if it exists, if it does not exist it will 
generate the appropriate request to mapserver to render a metatile and 
chop that into multiple tiles and store them in the cache, then serve 
the request tile from the cache.

So in your http section put the complete mapserver url, not the 
shortened one.

-Steve W

On 8/30/2013 5:50 PM, Schweitzer, Peter wrote:
> Help!
>
> I am trying to use mapcache, but I fear that I may have misunderstood
> the documentation.  Can someone help correct my misimpressions?
>
> I'm running a mapserver (6.2.0) instance with 113 WMS services.  Most
> don't really need caching because the data are simple or small.  One
> really does, because it is a geologic map of the continental US at
> 1:500k scale, with 320,000 polygons and 260,000 fault lines, and takes
> some time to render as map images.
>
> I have a complicating factor.  I'm using a simplified URL to access
> the map services, with an Apache rewrite rule like that rewrites the
> incoming URL http://mrdata.usgs.gov/services/sgmc-3857 to
> http://mrdata.usgs.gov/cgi-bin/mapserv?map=/mnt/mrt/map-files/sgmc-3857.map&...
>   This works nicely for OpenLayers.
>
> What I'd like to have happen is for the web server to provide cached
> images of these data rather than generating them on every web hit.
>
> So first of all, is mapcache the right tool for this task?
>
> Assuming that's right, I'm confused about the <url> element in the
> <source> section.  Should this be the existing WMS on my system?
> Should it be the URL sent by the user, prior to the apache rewrite
> rule?  Or should it be the URL that is the result of the rewrite rule?
>
> An OpenLayers interface that uses these data is at
> http://mrdata.usgs.gov/general/map.html  The layer in question is the
> "Geology" layer.
>
> I do not get any cached images.  I recognize that the problem may be
> somewhere else in this process, but here is my mapcache.xml file,
> cribbed and modified from an older list message by Stephen Woodbridge:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <mapcache>
>     <metadata>
>       <title>MRData mapcache service</title>
>       <abstract>Contains various services for MRData maps</abstract>
>     </metadata>
>
>     <cache name="disk" type="disk">
>       <base>/mnt/mrt/mapcache</base>
>       <symlink_blank/>
>     </cache>
>
>     <source name="sgmc" type="wms">
>       <getmap>
>         <params>
>           <FORMAT>image/png</FORMAT>
>           <MAP_IMAGETYPE>png</MAP_IMAGETYPE>
>           <LAYERS>Lithology,Faults,Dikes</LAYERS>
>           <MAP>/mnt/mrt/map-files/sgmc-3857.map</MAP>
>         </params>
>       </getmap>
>
>       <http>
>         <url>http://mrdata.usgs.gov/services/sgmc-3857</url>
>       </http>
>     </source>
>
>     <format name="PNGQ_FAST" type="PNG">
>       <compression>fast</compression>
>       <colors>256</colors>
>     </format>
>
>     <tileset name="sgmc">
>       <source>sgmc</source>
>       <cache>disk</cache>
>       <grid>WGS84</grid>
>       <grid>g</grid>
>       <grid>GoogleMapsCompatible</grid>
>       <format>PNGQ_FAST</format>
>       <metatile>5 5</metatile>
>       <expires>864000</expires>
>     </tileset>
>
>     <default_format>PNGQ_FAST</default_format>
>
>     <service type="wms" enabled="true">
>       <full_wms>assemble</full_wms>
>       <resample_mode>bilinear</resample_mode>
>       <format>PNGQ_FAST</format>
>       <maxsize>4096</maxsize>
>     </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>
>
> I am also not seeing error messages in either the apache log or the
> mapserver log.  Here is my apache config:
>
> LoadModule mapcache_module    modules/mod_mapcache.so
>
> <IfModule mapcache_module>
>      <Directory /mnt/mrt/mapcache>
>         Order Allow,Deny
>         Allow from all
>      </Directory>
>      MapCacheAlias /mapcache "/mnt/mrt/mapcache/mapcache.xml"
> </IfModule>
>
> Thanks in advance for any help you might provide.
>
> Peter
>



More information about the mapserver-users mailing list