[mapserver-users] Getting started with mapcache for WMTS...

Scott public at postholer.com
Mon Oct 25 18:05:11 PDT 2021


Yeah, the seeder is optional. If you have tiles that won't update often 
it might be handy to seed your entire tileset. Your server will love you.

Here's another take on mapcache config. This is how I set it up.
Note the absence of the SRS tag and the use of grid, format, cache tags. 
All 3 are defined elsewhere, not in the tileset itself, which means you 
can reuse them in any new tileset. See docs for more info:

    <source name="snowlevel2day-source" type="wms">
       <http>
 
<url>https://somedomain.com/cgi-bin/mapserverBin?map=/path/to/mapfile/mainmap.map</url>
          <connection_timeout>10</connection_timeout>
          <timeout>12</timeout>
       </http>
       <getmap>
          <params>
             <TRANSPARENT>true</TRANSPARENT>
             <FORMAT>image/png</FORMAT>
 
<LAYERS>ndfdsnowlevel,countylines,statelines,ndfdpttemp</LAYERS>
             <ndfdsnowlevelband>33</ndfdsnowlevelband>
             <ndfdpttempband>2</ndfdpttempband>
          </params>
       </getmap>
    </source>

    <tileset name="snowlevel2day">
       <metadata>
          <title>Day 2 Snow Levels</title>
       </metadata>
       <source>snowlevel2day-source</source>
       <cache>disk</cache>
       <format>mixed</format>
       <grid>google-900913</grid>
       <expires>14400</expires>
       <auto_expire>14400</auto_expire>
    </tileset>


On 10/25/21 4:46 PM, Carl Godkin wrote:
> Thanks for the suggestion, Scott.  I think the seeder is optional, right?
> 
> Anyway, I ended up figuring out that my <source> was wrong in a couple 
> of ways in mapcache.xml.  I misunderstood the
> <getmap>  parameters.  Now I have this:
> 
> <source name="faa" type="wms">
> <getmap>
> <params>
> <FORMAT>image/png</FORMAT>
> <LAYERS>FAA_Sectional_Charts</LAYERS>
> <SRS>EPSG:3857</SRS>
> </params>
> </getmap>
> <http>
> <url>http://localhost:8080/wms <http://localhost:8080/wms></url>
> </http>
> </source>
> 
> I wrote a tiny little leaflet test and, after making every possible 
> mistake, finally
> got it all to work so I'm all set. Thanks,
> 
> carl
> 
> 
> On Mon, Oct 25, 2021 at 3:24 PM Scott <public at postholer.com 
> <mailto:public at postholer.com>> wrote:
> 
>     Try using mapcache seeder. That will create some cached images to work
>     with. It will also test your mapcache config:
> 
>     https://mapserver.org/mapcache/seed.html
>     <https://mapserver.org/mapcache/seed.html>
> 
>     How you use those tiles is a whole different subject.
> 
> 
> 
>     On 10/25/21 2:54 PM, Carl Godkin wrote:
>      > Hi again,
>      >
>      > Is there a way to search through the mapserver-users mailing list
>      > archive except month-by-month?  If so, I can't find it.  (I
>     usually use
>      > my Gmail archives for GDAL and PROJ since I've subscribed forever to
>      > those but I'm a mapserver newbie.)  Anyway...
>      >
>      > I am trying to configure mapcache to serve from my (local and AFAICT
>      > fully working) WMS server on my MS4W 4.0.5 installation.  I am
>     following
>      > the  directions at https://mapserver.org/mapcache/index.html
>     <https://mapserver.org/mapcache/index.html>
>      > <https://mapserver.org/mapcache/index.html
>     <https://mapserver.org/mapcache/index.html>> as well as the steps
>     listed
>      > from the local MS4W page (#mapcache-apache-module).
>      >
>      > I think I understand the basic principles and have added a new
>     source
>      > that looks like this:
>      >
>      > <source name="faa" type="wms">
>      > <getmap>
>      > <params>
>      > <FORMAT>image/geotiff</FORMAT>
>      > <LAYERS>FAA_Sectional_Charts</LAYERS>
>      > <TRANSPARENT>TRUE</TRANSPARENT>
>      > <SRS>EPSG:4326</SRS>
>      > <BBOX>-125,24,-61,49</BBOX>
>      > </params>
>      > </getmap>
>      > <http>
>      > <url>http://localhost:8080/wms <http://localhost:8080/wms>
>     <http://localhost:8080/wms <http://localhost:8080/wms>></url>
>      > </http>
>      > </source>
>      >
>      > and a new tileset that looks like this:
>      >
>      > <tileset name="faa">
>      > <source>faa</source>
>      > <cache>disk</cache>
>      > <grid>WGS84</grid>
>      > <format>PNG</format>
>      > <metatile>5 5</metatile>
>      > <metabuffer>10</metabuffer>
>      > <expires>3600</expires>
>      > </tileset>
>      > (This is the same as the "test" tileset with a different source.)
>      >
>      > But how do I test this? The query
>      >
>      >
>     http://localhost:8080/mapcache/wmts?service=wmts&request=getcapabilities&version=1.0.0
>     <http://localhost:8080/mapcache/wmts?service=wmts&request=getcapabilities&version=1.0.0>
> 
>      >
>     <http://localhost:8080/mapcache/wmts?service=wmts&request=getcapabilities&version=1.0.0
>     <http://localhost:8080/mapcache/wmts?service=wmts&request=getcapabilities&version=1.0.0>>
>      >
>      > lists my new source as a layer. The docs say
>      >
>      >  5.
>      >
>      >     Test your MapCache configuration by following steps in the
>      >     associated MapCache testing docs
>      >   
>       <https://mapserver.org/mapcache/install.html#test-your-mapcache-module <https://mapserver.org/mapcache/install.html#test-your-mapcache-module>>
>      >
>      > but that seems to be about testing the mapcache/demo.  I don't
>     see how
>      > to add something to the mapcache/demo if that's possible.  What am I
>      > overlooking?
>      >
>      > Thanks a lot,
>      > carl
>      >
>      >
>      >
>      >
>      >
>      >
>      > _______________________________________________
>      > MapServer-users mailing list
>      > MapServer-users at lists.osgeo.org
>     <mailto:MapServer-users at lists.osgeo.org>
>      > https://lists.osgeo.org/mailman/listinfo/mapserver-users
>     <https://lists.osgeo.org/mailman/listinfo/mapserver-users>
>      >
> 
> 
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 


More information about the MapServer-users mailing list