<?xml version="1.0" encoding="UTF-8"?>
<mapcache>
   <metadata>
      <title>my mapcache service</title>
      <abstract>woot! this is a service abstract!</abstract>

      <!-- url

           uncomment and modify this if you need to provide another base url for
           getCapabilities requests (for the OnlineResource tags). You should use 
           this if there's a proxy between the client and the mod-mapcache service
           and you want the capabilities document to point to the correct endpoints.
      
      <url>http://mysuperhost/proxy/to/mapcache</url>
      -->
   </metadata>

  <environment>
    
    <!--
    
           environment variables can be set and overridden here
           this is useful on Windows servers to set a path
           to a certificates file when connecting to sources using HTTPS

    <CURL_CA_BUNDLE>C:/MapServer/bin/curl-ca-bundle.crt</CURL_CA_BUNDLE>
    -->
  </environment>
   <!--
        a grid represents the layout of tiles: srs, extent, resolutions, and tile size
   -->
   <grid name="testgrid">
      <metadata>
         <title>this is a custom grid I made up for an example</title>
         <!--
              OGC WMTS WellKnownScaleSet, if applicable
         <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
         -->
      </metadata>

      <!--
           Set to "true" if no new tiles should be created when not in
           the configured cache. If a requested tile is not present in
           a read-only cache, it will be returned as "nodata", i.e. fully
           transparent in a vertical assembly case, or as a 404 in a
           single-tile case.
           Note that the read-only status of a tileset is overridden to
           read-write by the seeder for the duration of the seeding
           session
      <read-only>true</read-only>
      -->

      <!-- 
           the spatial reference this tileset is in. a WMS client will need this for
           getMap requests. This is the srs that will be sent to the WMS source during
           a request, make sure that this srs is supported by the wms.
      -->
      <srs>EPSG:4326</srs>

      <!--
           equivalent values for the SRS that can be requested by a client.
           this value is essentially here to be able to support:
            - EPSG:900913 and EPSG:3857 for the googleMapsCompatible gridset
            - EPSG:2154 and IGNF:LAMB93
      -->
      <srsalias>EPSG:foobar</srsalias>

      <!--
           width and height of tiles. 256x256 is the usual size
      -->
      <size>256 256</size>

      <!--
           extent of the grid. the bottom left corner determines the origin of the tiles
           this should match the maxExtent property if using openlayers.
      -->
      <extent>-180 -90 180 90</extent>

      <!--
           array of resolutions for the tileset, in decreasing order
           this should match the resolutions property if using openlayers
      -->
      <resolutions>0.1 0.05 0.025 0.0125</resolutions>
   </grid>

   <!--
   <grid name="worldwind">
     <extent>-180 -90 180 90</extent>
     <srs>EPSG:4326</srs>
     <units>dd</units>
     <size>512 512</size>
     <resolutions>0.0703125000000000 0.0351562500000000 0.0175781250000000 8.78906250000000e-3 4.39453125000000e-3 2.19726562500000e-3 1.09863281250000e-3 5.49316406250000e-4 2.74658203125000e-4 1.37329101562500e-4 6.86645507812500e-5 3.43322753906250e-5 1.71661376953125e-5 8.58306884765625e-6 4.29153442382812e-6 2.14576721191406e-6 1.07288360595703e-6 5.36441802978516e-7</resolutions>
   </grid>
   -->

   <!--
         there are three preconfigured grids you can use in <tileset>s without having to
         explicitly define them here:
         <grid name="WGS84">
            <metadata>
               <title>GoogleCRS84Quad</title>
               <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad</WellKnownScaleSet>
            </metadata>
            <extent>-180 -90 180 90</extent>
            <srs>EPSG:4326</srs>
            <units>dd</units>
            <size>256 256</size>
            <resolutions>1.40625000000000 0.703125000000000 0.351562500000000 0.175781250000000 8.78906250000000e-2 4.39453125000000e-2 2.19726562500000e-2 1.09863281250000e-2 5.49316406250000e-3 2.74658203125000e-3 1.37329101562500e-3 6.86645507812500e-4 3.43322753906250e-4 1.71661376953125e-4 8.58306884765625e-5 4.29153442382812e-5 2.14576721191406e-5 1.07288360595703e-5 5.36441802978516e-6</resolutions>
         </grid>

         <grid name="GoogleMapsCompatible">
            <metadata>
               <title>GoogleMapsCompatible</title>
               <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
            </metadata>
            <extent>-20037508.3427892480 -20037508.3427892480 20037508.3427892480 20037508.3427892480</extent>
            <srs>EPSG:3857</srs>
            <srsalias>EPSG:900913</srsalias>
            <units>m</units>
            <size>256 256</size>
            <resolutions>156543.0339280410 78271.51696402048 39135.75848201023 19567.87924100512 9783.939620502561 4891.969810251280 2445.984905125640 1222.992452562820 611.4962262814100 305.7481131407048 152.8740565703525 76.43702828517624 38.21851414258813 19.10925707129406 9.554628535647032 4.777314267823516 2.388657133911758 1.194328566955879 0.5971642834779395 0.2985821417389697 0.1492910708694849 0.0746455354347424</resolutions>
         </grid>
   --> 

   <!-- this grid is identical to the previous one, except that it uses EPSG:900913 as the default srs as it is more supported -->
   <!--
        <grid name="g">
            <metadata>
               <title>GoogleMapsCompatible</title>
               <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible</WellKnownScaleSet>
            </metadata>
            <extent>-20037508.3427892480,-20037508.3427892480,20037508.3427892480,20037508.3427892480</extent>
            <srs>EPSG:900913</srs>
            <srsalias>EPSG:3857</srsalias>
            <size>256 256</size>
            <resolutions>
               156543.0339280410
               78271.51696402048
               39135.75848201023
               19567.87924100512
               9783.939620502561
               4891.969810251280
               2445.984905125640
               1222.992452562820
               611.4962262814100
               305.7481131407048
               152.8740565703525
               76.43702828517624
               38.21851414258813
               19.10925707129406
               9.554628535647032
               4.777314267823516
               2.388657133911758
               1.194328566955879
               0.5971642834779395
               0.2985821417389697
               0.1492910708694849
               0.0746455354347424
            </resolutions>
         </grid>
   --> 


   <!-- Lambert93 -->
   <grid name="LAMB93">
      <metadata>
         <title>Lambert 1993</title>
      </metadata>
      <extent>-357823.2365 6037008.6939 1313632.3628 7230727.3772</extent>
      <srs>EPSG:2154</srs>
      <srsalias>IGNF:LAMB93</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>

   <!-- RGF93 -->
   <grid name="RGF93">
      <metadata>
         <title></title>
      </metadata>
      <extent>-9.62 41.18 10.3 51.54</extent>
      <srs>EPSG:4171</srs>
      <srsalias>IGNF:RGF93</srsalias>
      <resolutions>0.026726773770953713 0.013363386885476856 0.006681693442738428 0.003340846721369214 0.001670423360684607 0.0008352116803423035 0.00041760584017115176 0.00020880292008557588 0.00010440146004278794 0.00005220073002139397 0.000026100365010696985 0.000013050182505348493 0.000006525091252674246 0.000003262545626337123 0.0000016312728131685616 0.0000008156364065842808</resolutions>
      <units>dd</units>
      <size>256 256</size>
   </grid>

   
   <!-- french geoportail grids -->
   <grid name="FXX">
      <metadata>
         <title>Géoportail - France métropolitaine</title>
      </metadata>
      <extent>-524288 4456448 786432 5767168</extent>
      <srs>EPSG:310024802</srs>
      <srsalias>IGNF:GEOPORTALFXX</srsalias>
      <srsalias>EPSG:310024001</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="ANF">
      <metadata>
         <title>Géoportail - Antilles françaises</title>
      </metadata>
      <extent>-6791168 1761280 -6553600 2023424</extent>
      <srs>EPSG:310915814</srs>
      <srsalias>IGNF:GEOPORTALANF</srsalias>
      <srsalias>EPSG:310495002</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="GUF">
      <metadata>
         <title>Géoportail - Guyane</title>
      </metadata>
      <extent>-6070272 235047 -5726208 647168</extent>
      <srs>EPSG:310486805</srs>
      <srsalias>IGNF:GEOPORTALGUF</srsalias>
      <srsalias>EPSG:310486003</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="MYT">
      <metadata>
         <title>Géoportail - Mayotte</title>
      </metadata>
      <extent>4901888 -1447936 4932608 -1405952</extent>
      <srs>EPSG:310702807</srs>
      <srsalias>IGNF:GEOPORTALMYT</srsalias>
      <srsalias>EPSG:310702005</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="REU">
      <metadata>
         <title>Géoportail - Réunion et dépendances</title>
      </metadata>
      <extent>5734400 -2383872 5808128 -2318336</extent>
      <srs>EPSG:310700806</srs>
      <srsalias>IGNF:GEOPORTALREU</srsalias>
      <srsalias>EPSG:310700004</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="NCL">
      <metadata>
         <title>Géoportail - Nouvelle-Calédonie</title>
      </metadata>
      <extent>16777216 -2555904 17301504 -2162688</extent>
      <srs>EPSG:310547809</srs>
      <srsalias>IGNF:GEOPORTALNCL</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="SPM">
      <metadata>
         <title>Géoportail - Saint-Pierre et Miquelon</title>
      </metadata>
      <extent>-4325376 5177344 -4259840 5308416</extent>
      <srs>EPSG:310706808</srs>
      <srsalias>IGNF:GEOPORTALSPM</srsalias>
      <srsalias>EPSG:310706006</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="WLF">
      <metadata>
         <title>Géoportail - Wallis et Futuna</title>
      </metadata>
      <extent>-19267584 -1638400 -19005440 -1441792</extent>
      <srs>EPSG:310642810</srs>
      <srsalias>IGNF:GEOPORTALWLF</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="CRZ">
      <metadata>
         <title>Géoportail - Crozet</title>
      </metadata>
      <extent>3801088 -5242880 4128768 -5046272</extent>
      <srs>EPSG:310642801</srs>
      <srsalias>IGNF:GEOPORTALCRZ</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="KER">
      <metadata>
         <title>Géoportail - Kerguelen</title>
      </metadata>
      <extent>4915200 -5636096 5177344 -5373952</extent>
      <srs>EPSG:310642812</srs>
      <srsalias>IGNF:GEOPORTALKER</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="PYF">
      <metadata>
         <title>Géoportail - Polynésie française</title>
      </metadata>
      <extent>-16384000 -2097152 -15990784 -1703936</extent>
      <srs>EPSG:310032811</srs>
      <srsalias>IGNF:GEOPORTALPYF</srsalias>
      <srsalias>EPSG:310032009</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="ASP">
      <metadata>
         <title>Géoportail - Amsterdam et Saint-Paul</title>
      </metadata>
      <extent>-6791168 1761280 -6553600 2023424</extent>
      <srs>EPSG:310642813</srs>
      <srsalias>IGNF:GEOPORTALASP</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="TERA">
      <metadata>
         <title>Terre Adélie 1950</title>
      </metadata>
      <extent>196098 225276 720386 749564</extent>
      <srs>EPSG:2986</srs>
      <srsalias>IGNF:TERA50STEREO</srsalias>
      <resolutions>2048 1024 512 256 128 64 32 16 8 4 2 1 0.5 0.25 0.125 0.0625</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>
   <grid name="MILLER">
      <metadata>
         <title>Géoportail - Monde</title>
      </metadata>
      <extent>-20037504 -10018752 20037504 10018752</extent>
      <srs>EPSG:310642901</srs>
      <srsalias>IGNF:MILLER</srsalias>
      <resolutions>39135.75 19567.875 9783.9375 4891.96875 2445.984375</resolutions>
      <units>m</units>
      <size>256 256</size>
   </grid>

   <!--
        a cache is where tiles are stored once they have been rendered
   -->
   <cache name="disk" type="disk">

      <!-- base
           
           absolute filesystem path where the tile structure will be stored.
           this directory needs to be readable and writable by the user running
           apache
      -->
      <base>/tmp</base>

      <!-- symlink_blank
           
           enable blank (i.e. uniform color) tile detection. blank tiles will be
           detected at creation time and linked to a single blank tile on disk to
           preserve disk space.
      -->
      <symlink_blank/>
      <!-- detect_blank
          Similar to symlink_blank, except completely skip writing a file
          if a blank, fully transparent tile is detected.
          Note: This setting should only be used when using the seeder.  If used
          on demand, mapcache will query the WMS source on each subsequent 
          tile request.
      -->
      <detect_blank/>
   </cache>

   <cache name="tmpl" type="disk">
      <!-- template

          string template that will be used to map a tile (by tileset, grid name, dimension,
          format, x, y, and z) to a filename on the filesystem.
          the following replacements are performed:
          - {tileset} : the tileset name
          - {grid} : the grid name
          - {dim} : a string that concatenates the tile's dimension
          - {ext} : the filename extension for the tile's image format
          - {x},{y},{z} : the tile x,y,z values
          - {inv_x}, {inv_y}, {inv_z} : inverted x,y,z values (inv_x = level->maxx - x - 1). This
               is mainly used to support grids where one axis is inverted (e.g. the google schema)
               and you want to create on offline cache.

         * note that this type of cache does not support blank-tile detection and symlinking.
      
         * warning: it is up to you to make sure that the template you chose creates a unique
           filename for your given tilesets. e.g. do not omit the {grid} parameter if your
           tilesets reference multiple grids. Failure to do so will result in filename
           collisions ! 

      -->
      <template>/tmp/template-test/{tileset}#{grid}#{dim}/{z}/{x}/{y}.{ext}</template>

      <!-- detect_blank
          Similar to symlink_blank, except completely skip writing a file
          if a blank, fully transparent tile is detected.
          Note: This setting should only be used when using the seeder.  If used
          on demand, mapcache will query the WMS source on each subsequent 
          tile request.
      -->
      <detect_blank/>
   </cache>

   <!-- memcache cache
        entry accepts multiple <server> entries
        requires a fairly recent apr-util library and headers
   <cache name="memcache" type="memcache">
      <server>
         <host>localhost</host>
         <port>11211</port>
      </server>
   </cache>
   -->

   <!-- redis cache
        requires that hiredis library be installed
   <cache name="redis" type="redis">
       <host>redis.mysite.com</host>
       <port>6379</port>
   </cache>
   -->
   
   <!-- sqlite cache
        requires building with "with-sqlite"
   -->
   <cache name="sqlite" type="sqlite3">
      <!-- dbfile
           
           absolute filesystem path where the sqlite database files will be stored.
           this file needs to be readable and writable by the user running
           apache
      -->
      <dbfile>/tmp/mysqlitetiles.db</dbfile>

      <!-- pragma
           special sqlite pragmas sent to db at connection time. The following
           would execute:
           PRAGMA key=value;
           useful for changing default values e.g. on large databases.

      -->
      <pragma name="key">value</pragma>
      <!-- queries
            SQL to be sent to sqlite backend for operations on tiles. The default queries that are
            sent are listed below
      --> 
      <queries>
        <create>create table if not exists tiles(tileset text, grid text, x integer, y integer, z integer, data blob, dim text, ctime datetime, primary key(tileset,grid,x,y,z,dim))</create>
        <exists>select 1 from tiles where x=:x and y=:y and z=:z and dim=:dim and tileset=:tileset and grid=:grid</exists>
        <get>select data,strftime("%s",ctime) from tiles where tileset=:tileset and grid=:grid and x=:x and y=:y and z=:z and dim=:dim</get>
        <set>insert or replace into tiles(tileset,grid,x,y,z,data,dim,ctime) values (:tileset,:grid,:x,:y,:z,:data,:dim,datetime('now'))</set>
        <delete>delete from tiles where x=:x and y=:y and z=:z and dim=:dim and tileset=:tileset and grid=:grid</delete>
      </queries>
   </cache>
   <!--
   <cache name="mbtiles" type="mbtiles">
      <dbname_template>/Users/tbonfort/Documents/MapBox/tiles/natural-earth-1.mbtiles</dbname_template>
   </cache>
   -->

   <!-- Berkeley DB cache
     note that a bdb cache will create a single database file, even if multiple
     tilesets/grids/dimensions are going to be used with it.
     if you need to have different db files for each tileset, then create multiple
     cache entries
   -->
   <cache name="bdb" type="bdb">
      <!-- base (required)
         absolute filesystem path where the berkeley db database file is to be stored.
         this directory must exist, and be writable
      -->
      <base>/tmp/foo/</base>
      <!-- key_template (optional)
         string template used to create the key for a tile entry in the database.
         defaults to the value below. you should include {tileset}, {grid} and {dim} here
         unless you know what you are doing, or you will end up with mixed tiles
      <key_template>{tileset}-{grid}-{dim}-{z}-{y}-{x}.{ext}</key_template>
      -->
   </cache>
   
   <!-- Tokyo Cabinet cache
   -->
   <cache name="tc" type="tokyocabinet">
      <base>/tmp/</base> <!-- will create /tmp/tokyocabinet.tcb , not configurable yet -->
      <key_template>{tileset}-{grid}-{dim}-{z}-{y}-{x}.{ext}</key_template>
   </cache>
   
   <cache name="myrestcache" type="rest">
     <url>https://myserver/webdav/{tileset}/{grid}/{z}/{x}/{y}.{ext}</url>
     <headers>
       <Host>my-virtualhost-alias.domain.com</Host>
     </headers>
     <operation type="put">
       <headers>
         <X-my-specific-put-header>foo</X-my-specific-put-header>
       </headers>
     </operation>
     <operation type="get">
       <headers>
         <X-my-specific-get-header>foo</X-my-specific-get-header>
       </headers>
     </operation>
     <operation type="head">
       <headers>
         <X-my-specific-head-header>foo</X-my-specific-head-header>
       </headers>
     </operation>
     <operation type="delete">
       <headers>
         <X-my-specific-delete-header>foo</X-my-specific-delete-header>
       </headers>
     </operation>
   </cache>
   <cache name="s3" type="s3">
     <url>https://foo.s3.amazonaws.com/tiles/{tileset}/{grid}/{z}/{x}/{y}/{ext}</url>
     <headers>
       <Host>foo.s3.amazonaws.com</Host>
     </headers>
     <id>foo</id>
     <secret>foo/sdsvd</secret>
     <region>eu-west-1</region>
     <operation type="put">
       <headers>
         <x-amz-storage-class>REDUCED_REDUNDANCY</x-amz-storage-class>
         <x-amz-acl>public-read</x-amz-acl>
       </headers>
   </operation>
   </cache>
   <cache name="azure" type="azure">
     <url>https://foo.blob.core.windows.net/tiles/{tileset}/{grid}/{z}/{x}/{y}/{ext}</url>
     <headers>
       <Host>foo.blob.core.windows.net</Host>
     </headers>
     <id>foo</id>
     <secret>foobarcccccccccccccccccccccyA==</secret>
     <container>tiles</container>
   </cache>

   <cache name="google" type="google">
     <url>https://storage.googleapis.com/mytiles-mapcache/{tileset}/{grid}/{z}/{x}/{y}.{ext}</url>
     <access>GOOGPGDWFDG345SDFGSD</access>
     <secret>sdfgsdSDFwedfwefr2345324dfsGdsfgs</secret>
     <operation type="put">
       <headers>
         <x-amz-acl>public-read</x-amz-acl>
       </headers>
     </operation>
   </cache>

   <!-- TIFF cache on local disk (read/write) -->
   <cache name="my_tiff_cache" type="tiff">
       <template>cache_tiff/{tileset}/{grid}/L{z}/R{inv_y}/C{x}.tif</template>
    </cache>

   <!-- TIFF cache in URL (read-only) -->
   <cache name="my_tiff_cache_rest_storage" type="tiff">
       <template>https://example.com/cache_tiff/{tileset}/{grid}/L{z}/R{inv_y}/C{x}.tif</template>
       <storage type="rest">
            <header_file>/dev/shm/google-mapcache.header</header_file> <!-- optional -->
            <timeout>10</timeout> <!-- optional -->
            <connection_timeout>3</connection_timeout> <!-- optional -->
       </storage>
    </cache>

   <!-- TIFF cache in Google Cloud Storage (read-only) -->
   <cache name="my_tiff_cache_google_storage" type="tiff">
       <template>https://storage.googleapis.com/cache_tiff/{tileset}/{grid}/L{z}/R{inv_y}/C{x}.tif</template>
       <storage type="google">
            <access>GOOGPGDWFDG345SDFGSD</access>
            <secret>sdfgsdSDFwedfwefr2345324dfsGdsfgs</secret>
            <timeout>10</timeout> <!-- optional -->
            <connection_timeout>3</connection_timeout> <!-- optional -->
       </storage>
   </cache>

   <!-- format

        a format is an image algorithm used for compressing images
        types can be "PNG" or "JPEG"
   -->
   <format name="PNGQ_FAST" type ="PNG">
      
      <!-- compression

           png compression: best or fast
           note that "best" compression is cpu intensive for little gain over the default
           default compression is obtained by leaving out this tag.
      -->
      <compression>fast</compression>

      <!-- colors

         if supplied, this enables png quantization which reduces the number of colors
         in an image to atain higher compression. this operation is destructive, and can
         cause artifacts in the stored image.
         the number of colors can be between 2 and 256
     -->
     <colors>256</colors>
   </format>
   <format name="myjpeg" type ="JPEG">
      <!-- quality

           JPEG compression quality, ranging from 0 to 100
           95 produces high quality images with few visual artifacts
           values under around 80 produce small images but with visible artifacts.
           YMMV
      -->
      <quality>75</quality>  

      <photometric>RGB</photometric>   <!-- RGB | YCBCR -->
      <optimize>true</optimize>  <!-- true | false | arithmetic -->
   </format>
   <format name="PNG_BEST" type ="PNG">
      <compression>best</compression>
   </format>

   <format name="mixed" type="MIXED">
      <transparent>PNG_BEST</transparent>
      <opaque>JPEG</opaque>
   </format>

   <!--
   <source name="bluemarble" type="gdal">
      <data>/gro2/data/bluemarble/bluemarble.vrt</data>
   </source>
   -->
   <!-- source

      the service to query for obtaining images if they are not in the cache
      for now, type can only be "wms"
   -->
   <source name="vmap0" type="wms">
      
      <!-- getmap

         extra parameters that will be added to the GetMap request. you can specify any
         parameter here, e.g. VERSION if you want to override the version of the WMS
         request.
         the LAYERS parameter is mandatory.
         usual parameters here are FORMAT , or MAP if using mapserver
      -->
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS>basic</LAYERS>
         </params>
      </getmap>
      
      <!-- http

         http url and parameters that will be used when making WMS requests
      -->
      <http>
         
         <!-- url

         url of the wms service, without any parameters
         -->
         <url>http://vmap0.tiles.osgeo.org/wms/vmap0</url>
         
         <!-- headers

            http headers added to request. make sure you know what you are 
            doing when adding a header here, as they take precedence over any
            default headers curl will be adding to the request.
            typical headers that can be added here are User-Agent and Referer.
            
            when adding a <key>value</key> element here, the request to the
            wms source will contain the

            key: value\r\n

            HTTP header.
         -->
         <!--
         <headers>
            <User-Agent>mod-mapcache/r175</User-Agent>
            <Referer>http://www.mysite.com?param=2&amp;par=4</Referer>
         </headers>
         -->

         <!-- TODO other http parameters
              * PROXY
              * AUTH
         -->

         <!-- timeout in seconds before bailing out from a request if no connection was created -->
         <connection_timeout>30</connection_timeout>
         
         <!-- timeout in seconds before bailing out from a request. This is the total time needed
              to fulfill the request, and includes the time needed to transfer the response through
              the network. Defaults to 600 seconds, set to a higher value if e.g. WMS requests for
              large metatiles take longer than 10 minutes to render -->
         <timeout>300</timeout>
      </http>
   </source>
   <source name="osm" type="wms">
      <http>
         <url>http://localhost/cgi-bin/mapserv?</url>
      </http>
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS>default</LAYERS>
            <!--<MAP>/Users/tbonfort/dev/mapserver-utils/empty.map</MAP>-->
            <MAP>/Users/tbonfort/dev/mapserver-utils/osm-google.map</MAP>
         </params>
      </getmap>
   </source>
   <source name="nexrad" type="wms">
      <http>
         <url>http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi</url>
      </http>
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS>nexrad_base_reflect</LAYERS>
            <TRANSPARENT>true</TRANSPARENT>
         </params>
      </getmap>
   </source>
   <source name="basic" type="wms">
      <http>
         <url>http://geoservices.brgm.fr/geologie?</url>
      </http>
      <getmap>
         <params>
            <FORMAT>image/png</FORMAT>
            <LAYERS>GRAVI_BASE</LAYERS>
            <TRANSPARENT>true</TRANSPARENT>
         </params>
      </getmap>

      <!-- getfeatureinfo
           additional parameters to use if you want to enable proxying GetFeatureInfo requests
           to this source
      -->
      <getfeatureinfo>
         <!-- info_formats: comma separated list of wms info_formats supported by the source WMS.
              you can get this list by studying the source WMS capabilities document.
         -->
         <info_formats>text/plain,application/vnd.ogc.gml</info_formats>

         <!-- KVP params to pass with the request. QUERY_LAYERS is mandatory -->
         <params>
            <QUERY_LAYERS>GRAVI_BASE</QUERY_LAYERS>
         </params>
      </getfeatureinfo>
   </source>

   <!-- tileset
      a tileset regroups a <source>, <grid> and <cache>.
      the "name" parameter is mandatory, and represents the key by which this tileset
      will be requested by clients (e.g. in the WMS LAYERS parameter)
   -->
   <tileset name="test">

      <!-- source: the "name" attribute of a preconfigured <source> -->
      <source>vmap0</source>

      <!-- cache: the "name" attribute of a preconfigured <cache> -->
      <cache>sqlite</cache>

      <!-- grid: the "name" attribute of a preconfigured <grid> 
         you can also use the following notation to limit the area that will be cached and served to clients:
         <grid restricted_extent="-10 40 10 50">WGS84</grid>
         this way is better than using a grid with a limited extent, as in this way the tiles that are already
         cached are not invalidated should you want to modify the restricted extent in the future. When using
         the restricted_extent attribute, you should give the corresponding information to the client that will
         be using the service.
         you can also limit the zoom levels that are cached/accessible by using the minzoom, maxzoom attributes.


         NOTE: when adding a <grid> element, you *MUST* make sure that the source you have selected is able to
         return images in the grid's srs.
      -->
         <grid restricted_extent="-10 40 10 50" minzoom="6" maxzoom="8">WGS84</grid>
         <grid>g</grid>

      <!-- metadata
         optional metadata tags used for responding to GetCapabilities request.
         you can put anything in here, although only the title, abstract and
         keywords tags are currently used to populate the GetCapabilities
         document.
      -->
      <metadata>
         <title>vmap0 map</title>
         <abstract>blabla</abstract>
         <keywords>
           <keyword>foo</keyword>
           <keyword>bar</keyword>
         </keywords>
      </metadata>

      <!-- watermark

         optional tag to add a watermark to the tiles *before* storing them to cache
         the supplied image MUST be exactly the same size as the size of the tiles
         configured in the <grid>
         the supplied image is read when the configuration is loaded.
         if you make changes to the image, they will NOT be reflected on tiles already
         stored in the cache, nor on newly stored tiles until the server is restarted
      <watermark>/home/tbonfort/dev/mod-mapcache/static/watermark.png</watermark>
      -->
      
      <!-- format
         (optional) format to use when storing a tile. this should be a format with high
         compression, e.g. png with compression "best", as the compression operation is only
         done once at creation time.
         if left out, no recompression is applied to the image, mod-mapcache will store the
         exact image received from the <source>
         note that the <format> tag is mandatory if metatile, metabuffer or watermark are
         supplied, as in those cases a recompression has to be done.
      -->
      <format>PNG</format>

      <!-- metatile
         number of columns and rows to use for metatiling, see http://geowebcache.org/docs/current/concepts/metatiles.html
      -->
      <metatile>5 5</metatile>

      <!-- metabuffer
         area around the tile or metatile that will be cut off to prevent some edge artifacts.
         if using this, the configured source must be instructed not to put any labels inside
         this area, as otherwise this will result in truncated labels (for mapserver, this is
         the "labelcache_map_edge_buffer" "-10" metadata entry, along with label PARTIALS FALSE
      -->
      <metabuffer>10</metabuffer>

      <!-- expires
         optional expiration value in seconds for a tile. this is expressed in a number of seconds
         after the creation date of the tile
         This is the value that will be set in the HTTP Expires and Cache-Control headers, and has
         no effect on the actual expiration of tiles on the caches. See <auto_expire> for that.
      -->
      <expires>3600</expires>

      <!-- auto_expire
         automatically re-request tiles and update the cache once they are older than the given number
         of seconds after their creation.
         Note that this will only delete tiles form the cache when they are accessed, you cannot
         use this configuration to limit the size of the created cache.
         Note that if set, this value overrides the value given by <expires>
      -->
      <auto_expire>86400</auto_expire>
      
      <!-- dimensions
         optional dimensions that should be cached
         the order of the <dimension> tags inside the <dimensions> is important as it is used
         to create the directory structure for the disk cache. i.e. if you change the order of these
         values, any tiles that have been previously cached are invalidated (but not removed from the 
         cache, it's just they don't exist anymore for mod-mapcache
      -->
      <dimensions>
         <!-- values dimension 
            the example here creates a DIM1 dimension
             * WMS and WMTS clients can now add a &DIM1=value to their request string. If they don't
            specify this key/value, the default will be to use DIM1=foobar
             * the allowed values for DIM1= are foobar (it is important to add the default value to the
               allowed values entry), foobarbaz, foo and bar.
             * the value specified for DIM1 will be forwarded to the WMS source
             * the produced tile will be stored in base/gridname/DIM1/value/xx/xx/xx/xx/xx/xx.png
               file. i.e. their are as many different caches created as their are values in the
               <values> tag.
         -->
	 <dimension type="values" name="DIM1" default="foobar">
		 <value>foobar</value>
		 <value>foobarbaz</value>
		 <value>foo</value>
		 <value>bar</value>
	 </dimension>
         
         <!-- regex dimension
            the following creates a MAPFILE dimension, for using the same mod-mapcache tileset with different
            mapserver mapfiles. the name of the mapfiles need not be known to mod-mapcache, and can therefore be 
            created even after mod-mapcache has been started.
            when a user passes a MAPFILE=/path/to/mapfile, the string "/path/to/mapfile" is validated against
            the supplied (PCRE) regular expression. The one in this example allows a name composed of alphanumeric characters
            separated by slashes (/) and finishing with ".map" ( [a-zA-Z0-9\./]*\.map$ ) , but will fail if there
            are two consecutive dots (..) in the path, to prevent filesystem traversal  ( (?!.*\.\.) ).
         -->
	 <dimension type="regex" name="MAPFILE" default="/path/to/mapfile.map">
		 <regex>^(?!.*\.\.)[a-zA-Z0-9\./]*\.map$</regex>
	 </dimension>
	 
         <!-- intervals dimension
            the syntax is the same as common-ows, i.e. a comma separated list of "min/max/resolution" entries.
            eg: 
               * 0/5000/1000 allows the values 0,1000,2000,3000,4000 and 5000
               * 0/100/0 allows any values between 0 and 100
               * both values can be combined: 0/5000/1000,0/100/0
         -->
         <dimension name="ELEVATION" type="intervals" default="0">0/5000/1000</dimension>	 


         <!-- coming in a future version: support for ISO8601 date/time dimensions -->

      </dimensions>
   </tileset>
   <tileset name="test2">
      <source>nexrad</source>
      <cache>disk</cache>
      <format>mixed</format>
      <grid>WGS84</grid>
   </tileset>
   <tileset name="brgm">
      <source>basic</source>
      <cache>disk</cache>
      <format>PNG</format>
      <grid>WGS84</grid>
      <metatile>5 5</metatile>
      <metabuffer>30</metabuffer>
   </tileset>
   <!--
   <tileset name="natural-earth-1">
      <source>osm</source>
      <cache>mbtiles</cache>
      <format>PNG</format>
      <grid>g</grid>
   </tileset>
   -->
   <tileset name="osm">
      <metadata>
         <title>osm mapserver served map of midi-pyrénées</title>
         <abstract>see http://mapserver-utils.googlecode.com</abstract>
      </metadata>
      <source>osm</source>
      <cache>sqlite</cache>
      <format>PNG</format>
      <grid>FXX</grid>
      <grid>MILLER</grid>
      <grid>WGS84</grid>
      <grid>g</grid>
      <metatile>5 5</metatile>
      <expires>1</expires>
      <!--<auto_expire>86400</auto_expire>-->
      <metabuffer>10</metabuffer>
   </tileset>

   <!--
   <tileset name="bluemarble">
      <source>bluemarble</source>
      <cache>disk</cache>
      <metatile>5 5</metatile>
      <format>PNG</format>
      <grid>google,WGS84</grid>
   </tileset>
   -->


   <!-- default_format
      format to use when a client asks for an image that is dynamically created from multiple
      tiles from the cache.
      note that using a png format with "best" compression is not recommended
      here as it comes with a very compression overhead in terms of cpu processing. it is
      recommended to use a png format with "fast"compression here, unless you have plenty
      of server cpu power and or limited bandwidth
   -->
   <default_format>JPEG</default_format>

   <!-- services
      services that will be responded to by mod-mapcache
      each service is accessible at the url http://host/path/to/mapcache/{service},
      eg http://myhost/mapcache/wms for OGC WMS.
   -->
   <service type="wms" enabled="true">
      <!-- this service should actually be called "ogc". It is different from the other
           services as it does not listen on the /wms endpoint, but directly on /.
           It will intercept wms getmap requests that can be treated from configured
           tilesets, and can optionally forward all the rest to (an)other server(s)
           TODO: this needs way more documenting
      <forwarding_rule name="foo rule">
            <append_pathinfo>true</append_pathinfo>
            <http>
               <url>http://localhost/mapcacheproxy</url>
            </http>
      </forwarding_rule>
      -->
      <!-- full_wms
           configure response to wms requests that are not aligned to a tileset's grids.
           responding to requests that are not in the SRS of a configured grid is not supported, but
           this should never happen as only the supported SRSs are publicized in the capabilities
           document.

           allowed values are:
             - error: return a 404 error (default)
             - assemble: build the full image by assembling the tiles from the cache
             - forward: forward the request to the configured source.
      -->
      <full_wms>assemble</full_wms>
      <!-- resample mode
      filter applied when resampling tiles for full wms requests.
      can be either:
      - nearest : fastest, poor quality
      - bilinear: slower, higher qulity
      -->
      <resample_mode>bilinear</resample_mode>
      
      <!-- format
         image format to use when assembling tiles
      -->
      <format>myjpeg</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
        configure how error will be reported back to a client:
          - log : no error is reported back, except an http error code.
          - report : return the error message to the client in textual format
          - empty_img : return an empty image to the client. the actual error code is in the X-Mapcache-Error http header
          - report_img : return an image with the error text included inside. not implemented yet.

        the default setting is to report the error message back to the user. In production, you might want to set this to "log"
        if you're paranoid, or to "empty_img" if you want to play nice with non-conforming clients.
   -->
   <errors>report</errors>

   
   
   <locker type="disk">  <!-- this is the default -->
   <!--
        location to put lockfiles (to block other clients while a metatile is being rendered.
        defaults to /tmp
        this location should be writable by the apache user
   -->
     <directory>/tmp</directory>
     <retry>0.01</retry> <!-- check back every .01 seconds -->
   </locker>

   <lock_dir>/tmp</lock_dir>  <!-- deprecated, use <locker type="disk"> -->


   <locker type="memcache">
     <server>
       <host>localhost</host>
       <port>11211</port>
     </server>
     <server>
       <host>memcache-host</host>
       <port>11212</port>
     </server>
     <retry>0.3</retry> <!-- check back every .3 seconds if the lock has been released -->
   </locker>



   <!-- use multiple threads when fetching multiple tiles (used for wms tile assembling -->
   <threaded_fetching>true</threaded_fetching>
   

   <!--
        Parameters for fine tuning connection_pool component, used for
        connections to caches
        - max_connections: maximum number of open connections at the same time
          (default: 1024)
        - time_to_live_us: maximum amount of time in microseconds an unused
          connection is valid (default 60s)
   -->
   <connection_pool>
     <max_connections>2000</max_connections>
     <time_to_live_us>1000000</time_to_live_us>
   </connection_pool>

   
   <!-- fastcgi only -->
   <log_level>info</log_level> <!-- logging verbosity -->
   <auto_reload>true</auto_reload> <!-- auto reload if config file changed -->

</mapcache>
