1

I'm trying to cache OpenStreetMap related tile. The corresponding server has separate data related to opeenstreetmap (http://xx.xx.xx.xx/osm). It's an XZY Tiles service. Within the mapcache.xml file I set the source type to be tms service. But when I restart my Apache service I get a message:unknown source type tms for source osm.

Mapcache.xml file:

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

<mapcache >
   <cache name="disk" type="disk">
      <base>C:/ms4w/tmp/ms_tmp/cache/primer3/{tileset}/{z}-{x}-{y}.{ext}</base>
      <!--<symlink_blank/>-->
   </cache>

   <source name="osm" type="tms">
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS></LAYERS>
         </params>
      </getmap>

      <http>
         <url>http://xx.xx.xx.xx/tile/{z}/{x}/{y}.png</url>
      </http>
   </source>

   <tileset name="test">
      <source>osm</source>
      <cache>disk</cache>
      <grid>g</grid>
      <format>PNG</format>
      <metatile>5 5</metatile>
      <metabuffer>10</metabuffer>
      <expires>3600</expires>
   </tileset>


   <default_format>JPEG</default_format>
   <service type="tms" enabled="true">
      <full_wms>assemble</full_wms>
      <resample_mode>bilinear</resample_mode>
      <format>PNG</format>
      <maxsize>4096</maxsize>
   </service>
   <service type="wms" enabled="true">
   </service>
   <service type="wmts" 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>C:/ms4w/tmp/ms_tmp/cache/primer2</lock_dir>

</mapcache>

Why does it report that the unknown type is tms if it exists as a defined service?

1

I can read from the documentation https://mapserver.org/mapcache/config.html

A source is a service mod-mapcache can query to obtain image data. This is typically a WMS server accessible by a URL. (There are currently only WMS, WMTS and mapfile as sources, though others may be added later if the need arises, see Data Sources).

The error message is telling that "tms" type of service is not supported as a source. The documentation about how to configure the supported source types is in https://mapserver.org/mapcache/sources.html#mapcache-sources

You can use tms service as a source with MapProxy https://mapproxy.org/docs/nightly/sources.html.

1

In the MapCache terminology, service refers to protocols used for querying local MapCache and source refers to protocols used for querying remote servers.

XZY Tiles services like OSM can be accessed by MapCache with a REST cache configuration. If you need to cache it locally, you can define a tileset using this REST cache, then a WMS source + cache + tileset refering to this tileset:

<cache name="remote-openstreetmap" type="rest">
   <url>http://xx.xx.xx.xx/tile/{z}/{x}/{inv_y}.png</url>
   <headers><User-Agent>mod_mapcache/1.9dev</User-Agent></headers>
</cache>
<tileset name="remote-openstreetmap">
   <cache>remote-openstreetmap</cache>
   <grid>GoogleMapsCompatible</grid>
</tileset>

<source name="openstreetmap" type="wms">
   <http><url>http://localhost/mapcache?</url></http>
   <getmap><params>
      <format>image/png</format>
      <layers>remote-openstreetmap</layers>
   </params></getmap>
</source>
<cache name="openstreetmap" type="sqlite3">
   <dbfile>/share/caches/osm/openstreetmap.sqlite3</dbfile>
</cache>
<tileset name="openstreetmap">
   <source>openstreetmap</source>
   <format>PNG</format>
   <cache>openstreetmap</cache>
   <grid>GoogleMapsCompatible</grid>
</tileset>

<service type="wms" enabled="true"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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