i tried to configure mapcache to use with sqlite database, but i have some problems. I want make cache for four layers, but i dont know, how to do this. When i make more tilesets, i get error: duplicate tileset with name "mirror"

<cache name="sqlite" type="sqlite3">
    <dbfile>/opt/share/maps/mapcache_data/test/test.db</dbfile>
    <pragma name="max_page_count">10000000</pragma>
    <detect_blank/>
</cache>

<cache name="sqlite2" type="sqlite3">
    <dbfile>/opt/share/maps/mapcache_data/test/test2.db</dbfile>
    <pragma name="max_page_count">10000000</pragma>
    <detect_blank/>
</cache>

<source name="zdroj" type="wms">
    <getmap>
        <params> 
         <MAP>/opt/share/maps/map_configs/czechia/main.map</MAP>
          <FORMAT>image/png</FORMAT>
            <transparent>true</transparent>
            <compression>fast</compression>
            <colors>256</colors>
        </params>
    </getmap>
    <http>
        <url>http://172.17.0.1:8085/fcgi-bin/mapserv?</url>
    </http>
</source>

<format name="PNG_BEST" type ="PNG">
    <transparent>true</transparent>
    <compression>fast</compression>
     <colors>256</colors>
</format>

<tileset name="layer1">
    <source>zdroj</source> 
    <cache>sqlite</cache>
    <grid>gridRP</grid>
    <format>PNG_BEST</format>
    <metatile>5 5</metatile> 
    <metabuffer>125</metabuffer>
    <expires>1000</expires>
 </tileset>

<tileset name="layer2">
    <source>zdroj</source> 
    <cache>sqlite2</cache>
    <grid>gridRP</grid>
    <format>PNG_BEST</format>
    <metatile>5 5</metatile> 
    <metabuffer>125</metabuffer>
    <expires>1000</expires>
 </tileset>

0 5000000 4000000 8000000 </extent>--> 1326946 6055035 2520587 6633511 EPSG:3857 m 256 256 156412 78206 39103 19551 9776 4888 2444 1222 610.984 305.492 152.746 76.373 38.187 19.093 9.547 4.773 2.387 1.193 0.596 0.298

<service type="wms" enabled="true">
    <full_wms>assemble</full_wms>
    <format>PNG_BEST</format>
</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"/>

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

up vote 0 down vote accepted

The WMS parameters require LAYERS, as < LAYERS >layer1,layer2< /LAYERS >. Thus, to create a cache for each layer you must create a source with each of the layers, and associate each cache, respectively.

<cache name="sqlite" type="sqlite3">
    <dbfile>/opt/share/maps/mapcache_data/test/test.db</dbfile>
    <pragma name="max_page_count">10000000</pragma>
    <detect_blank/>
</cache>

<cache name="sqlite2" type="sqlite3">
    <dbfile>/opt/share/maps/mapcache_data/test/test2.db</dbfile>
    <pragma name="max_page_count">10000000</pragma>
    <detect_blank/>
</cache>

<source name="zdroj_layer1" type="wms">
    <getmap>
        <params> 
         <MAP>/opt/share/maps/map_configs/czechia/main.map</MAP>
          <FORMAT>image/png</FORMAT>
          <LAYERS>layer1</LAYERS>
            <transparent>true</transparent>
            <compression>fast</compression>
            <colors>256</colors>
        </params>
    </getmap>
    <http>
        <url>http://172.17.0.1:8085/fcgi-bin/mapserv?</url>
    </http>
</source>

<source name="zdroj_layer2" type="wms">
    <getmap>
        <params> 
         <MAP>/opt/share/maps/map_configs/czechia/main.map</MAP>
          <FORMAT>image/png</FORMAT>
          <LAYERS>layer2</LAYERS>
            <transparent>true</transparent>
            <compression>fast</compression>
            <colors>256</colors>
        </params>
    </getmap>
    <http>
        <url>http://172.17.0.1:8085/fcgi-bin/mapserv?</url>
    </http>
</source>

<format name="PNG_BEST" type ="PNG">
    <transparent>true</transparent>
    <compression>fast</compression>
     <colors>256</colors>
</format>

<tileset name="layer1">
    <source>zdroj_layer1</source> 
    <cache>sqlite</cache>
    <grid>gridRP</grid>
    <format>PNG_BEST</format>
    <metatile>5 5</metatile> 
    <metabuffer>125</metabuffer>
    <expires>1000</expires>
 </tileset>

<tileset name="layer2">
    <source>zdroj_layer2</source>  
    <cache>sqlite2</cache>
    <grid>gridRP</grid>
    <format>PNG_BEST</format>
    <metatile>5 5</metatile> 
    <metabuffer>125</metabuffer>
    <expires>1000</expires>
 </tileset>

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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