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

<!-- see the accompanying mapcache.xml.sample for a fully commented configuration file -->

<mapcache>
   <cache name="disk" type="disk">
      <base>/tmp</base>
      <symlink_blank/>
   </cache>
   <cache name="sqlite" type="sqlite3">
     <dbfile>/tmp/{tileset}-{z}-{grid}.db</dbfile>
      <detect_blank/>
   </cache>

   <source name="vmap0" type="wms">
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS>basic</LAYERS>
         </params>
      </getmap>
      
      <http>
         <url>http://vmap0.tiles.osgeo.org/wms/vmap0</url>
      </http>
   </source>
   
   <tileset name="t1">
      <source>vmap0</source>
      <cache>sqlite</cache>
      <grid>WGS84</grid>
      <grid>GoogleMapsCompatible</grid>
      <format>PNG</format>
      <metatile>5 5</metatile>
      <metabuffer>10</metabuffer>
      <expires>3600</expires>
	  <dimensions>
		  <dimension name="dim1" type="postgresql" default="d1">
			  <connection>host=localhost user=mapcache password=mapcache dbname=mapcache port=5433</connection>
			  <validate_query>select dim from dims where tileset=:tileset and dim=:dim</validate_query>
			  <list_query>select dim from dims where tileset=:tileset and tileset=:tileset</list_query>
		  </dimension>
	  </dimensions>
   </tileset>
   <tileset name="t2">
      <source>vmap0</source>
      <cache>sqlite</cache>
      <grid>WGS84</grid>
      <grid>GoogleMapsCompatible</grid>
      <format>PNG</format>
      <metatile>5 5</metatile>
      <metabuffer>10</metabuffer>
      <expires>3600</expires>
	  <dimensions>
		  <store_assemblies>false</store_assemblies>
		  <assembly_type>stack</assembly_type>
		  <dimension name="dim1" type="postgresql" default="d1" time="true">
			  <connection>host=localhost user=mapcache password=mapcache dbname=mapcache port=5433</connection>
			  <validate_query>select to_char(ts,'YYYY-MM-DD"T"HH24:MI:SS"Z"') from timedims where tileset=:tileset and ts&gt;=to_timestamp(:start_timestamp) and ts&lt;=to_timestamp(:end_timestamp) order by ts desc</validate_query>
			  <list_query>select to_char(ts,'YYYY-MM-DD"T"HH24:MI:SS"Z"') from timedims where tileset=:tileset</list_query>
		  </dimension>
	  </dimensions>
   </tileset>


   <default_format>JPEG</default_format>

   <service type="wms" enabled="true">
      <full_wms>assemble</full_wms>
      <resample_mode>bilinear</resample_mode>
      <format>JPEG</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="mapguide" enabled="true"/>
   <service type="demo" enabled="true"/>

   <errors>report</errors>
   <locker type="disk">
     <directory>/tmp</directory>
     <timeout>300</timeout>
    </locker>
	<log_level>debug</log_level>

</mapcache>
