[mapserver-users] mapcache config confusion

Stephen Woodbridge woodbri at swoodbridge.com
Tue Sep 3 18:16:23 PDT 2013


On 9/3/2013 5:32 PM, Schweitzer, Peter wrote:
> My thanks to Stephen and Andreas!
>
> Per Stephen's advice, I modified the URL given in the <http> element
> to point directly at the mapserver executable.  Per Andreas's advice,
> I've modified my OpenLayers interface to use the mapcache TMS for
> these data.  Is there a reason why I should prefer the WMS to the TMS
> other than a wish to conform to OGC specs?

WMS is not a tile protocol per say, WMTS is and TMS is etc. While you 
can force WMS requests to return just a tile, if the request is off a 
little then extra processing takes place to assemble the request from 
the tiles. There is no reason that you can not use WMS and request 
arbitrary images from mapcache and it will in fact honor those requests 
by stitching together the tiles needed and cropping them to your 
request, but these requests are not very useful from a browser caching 
point of view. The whole idea about tiles is the they are cachable in 
the browser and reuseable which cuts down on the server requests and 
computation.

-Steve W

> Peter
>
> On Mon, Sep 2, 2013 at 5:26 AM, Eichner, Andreas - SID-NLKM
> <Andreas.Eichner at sid.sachsen.de> wrote:
>>
>> Good news: it works. But your client needs to be configured to use the cache
>> layer. Currently you still use the source WMS. Since you have the demo service
>> of mapcache enabled, you can check this page http://mrdata.usgs.gov/mapcache/demo/tms
>> Let your browser show the page source and you can copy-paste the layer constructor:
>>
>> var sgmc_WGS84_tms_layer = new OpenLayers.Layer.TMS( "sgmc-WGS84-TMS",
>>          "http://mrdata.usgs.gov/mapcache/tms/",
>>          { layername: 'sgmc at WGS84', type: "png", serviceVersion:"1.0.0",
>>            gutter:0,buffer:0,isBaseLayer:true,transitionEffect:'resize',
>>            tileOrigin: new OpenLayers.LonLat(-180.000000,-90.000000),
>>            resolutions:[0.70312500000000000000,0.35156250000000000000,0.17578125000000000000,0.08789062500000000000,0.04394531250000000000,0.02197265625000000000,0.01098632812500000000,0.00549316406250000000,0.00274658203125000000,0.00137329101562500000,0.00068664550781250000,0.00034332275390625000,0.00017166137695312500,0.00008583068847656250,0.00004291534423828120,0.00002145767211914060,0.00001072883605957030,0.00000536441802978516],
>>            zoomOffset:0,
>>            units:"dd",
>>            maxExtent: new OpenLayers.Bounds(-180.000000,-90.000000,180.000000,90.000000),
>>            projection: new OpenLayers.Projection("EPSG:4326".toUpperCase()),
>>            sphericalMercator: false
>>          }
>>      );
>>      map.addLayer(sgmc_WGS84_tms_layer)
>>
>> Usually it is safe to omit most of the arguments as they are defaults or derived from the map object, like "serviceVersion" and "resolutions".
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: mapserver-users-bounces at lists.osgeo.org im Auftrag von Schweitzer, Peter
>> Gesendet: Fr 30.08.2013 23:50
>> An: mapserver-users at lists.osgeo.org
>> Betreff: [mapserver-users] mapcache config confusion
>>
>> 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
>> --
>> Peter N. Schweitzer (U.S. Geological Survey, Reston, VA 20192)
>> (703) 648-6533  email: pschweitzer at usgs.gov
>> http://geology.usgs.gov/peter/
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>
>
>



More information about the mapserver-users mailing list