.. _mapcache_config: ***************************************************************************** Configuration File ***************************************************************************** :Author: Thomas Bonfort :Contact: tbonfort at terriscope.fr The configuration files determines what and how mod-mapcache will serve incoming requests. It is an xml file that comprises a list of entries, as outlined here: .. code-block:: xml .... .... ... ... ... ... .. _mapcache_sources: Source ================================================================================ 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 no other sources than WMS implemented, others may be added later if the need arises) .. code-block:: xml image/png basic http://vmap0.tiles.osgeo.org/wms/vmap0 mod-mapcache/r175 http://www.mysite.com?param=2&par=4 30 * The name and type attributes are straightforward: type is "wms", and name is * the key by which this source will be referenced `` is the http location * where the service can be accessed `` is a list of parameters that * will be added to the wms request. You should probably at the very least add * the FORMAT and LAYERS parameters. By convention(?), WMS parameters are * uppercase, and you should respect this convention in your configuration file. * This is where you can also override some default WMS parameters if needed. By * default, the parameters that will be used are: `GetMap` * `WMS` `` `1.1.0` Cache ================================================================================ A cache is a location where received tiles will be stored. .. code-block:: xml /tmp localhost 11211 /tmp/{tileset}-{grid}.db false /Users/tbonfort/Documents/MapBox/tiles/natural-earth-1.mbtiles Format ================================================================================ A format is an image format that will be used to return tile data to clients, and to store tile data on disk. .. code-block:: xml fast 256 75 ycbcr best PNG_BEST JPEG .. _mapcache_grids: Grid ================================================================================ A grid is the matrix that maps tiles on an area, and consists of a spatial reference, a geographic extent, resolutions, and tile sizes. Mandatory Configuration Options -------------------------------------------------------------------------------- * ****: The width and height of an individual tile, in pixels. Must be specified as to positive integers separated by a space character. The most common entry for this is: .. code-block:: xml 256 256 * ****: The geographical extent covered by the grid, in ground units (e.g. meters, degrees, feet, ...). Must be specified as 4 floating point numbers separated be spaces, order like minx, miny, maxx, maxy. The (minx,miny) point defines the origin of the grid, i.e. the pixel at the bottom left of the bottom- leftmost tile is always placed on the (minx,miny) geographical point. The (maxx,maxy) point is used to determine how many tiles there are for each zoom level. .. code-block:: xml -180 -90 180 90 * ****: The projection of the grid, usually given by it epsg identifier. The actual meaning of the value put here isn't used directly by mapcache to compute reprojections, it is only used to lookup which grid to use when receiving WMS requests. .. code-block:: xml epsg:4326 .. note:: This is the value that is passed on to the :ref:`source ` when requesting a tile that is not already cached for the current grid. You must make sure that the source that is queried is capable of returning image data for this srs. * ****: The ground units used by the grid's projection. This entry is not used directly by mapcache aside from calculating scales for the WMTS capabilites document. Allowed values are: * **m**: meters * **dd**: decimal degrees * **ft**: feet .. code-block:: xml dd * ****: This is a list of resolutions for each of the zoom levels defined by the grid. This must be supplied as a list of positive floating point values, separated by a space and ordered from largest to smallest. The largest value will correspond to the grid's zoom level 0. Resolutions are expressed in "units-per-pixel", depending on the unit used by the grid (e.g. resolutions are in meters per pixel for most grids used in webmapping). .. code-block:: xml 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 Optional Configuration Options -------------------------------------------------------------------------------- * ****: This tag can be specified multiple times, and allows the user to add multiple srs entries for a given grid. This is especially usefull if the epsg id for a given projection has evolved over time, or to support other catalogues than the epsg one (which is the only catalog supported by the wms specification). .. code-block:: xml EPSG:310024802 IGNF:GEOPORTALFXX EPSG:310024001 * ****: * ****: The name of the grid, in human readable form. Appears in the capabilities documents. .. code-block:: xml <title>This grid covers the area blah blah blah * ****: see the WMTS keyword. This will add a WellKnownScaleSet entry to the WMTS capabilites document. It is up to the user to make sure that the supplied resolutions for the grid actually match the pre-defined WellKnownScaleSet. .. code-block:: xml urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad Preconfigured Grids -------------------------------------------------------------------------------- There are three predefined grids you can use without referencing them in the mapcache.xml file: * the "WGS84" grid corresponds to a grid where the whole world is rendered on 2 times 1 256x256 pixel tiles at level 0 (i.e. the (-180,-90,180,90) extent fits on a 512x256 image). It goes down to zoom level 17. .. code-block:: xml GoogleCRS84Quad urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad -180 -90 180 90 EPSG:4326 dd 256 256 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 * the "g" grid corresponds to the case when you wish to overlay tiles on top of googlemaps, and is the default tiling scheme used in webmapping applications. This grid goes down to zoom level 18. Level 0 is a single 256x256 tile. This grid's default srs is EPSG:900913 which is non-standard, but in wider use than than its official EPSG:3857 entry. .. code-block:: xml GoogleMapsCompatible urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible -20037508.3427892480 -20037508.3427892480 20037508.3427892480 20037508.3427892480 EPSG:900913 EPSG:3857 m 256 256 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 * the "GoogleMapsCompatible" grid is nearly identical to the "g" grid, except its default srs is EPSG:3857 instead of EPSG:900913. .. code-block:: xml GoogleMapsCompatible urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible -20037508.3427892480 -20037508.3427892480 20037508.3427892480 20037508.3427892480 EPSG:3857 EPSG:900913 m 256 256 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 Tileset ================================================================================ A tileset is the essential configuration item for mod-mapcache, and corresponds to a set of tiles coming from a *source*, stored in a *cache*, and returned to the client in a given *format*. .. code-block:: xml vmap0 sqlite WGS84 g vmap0 map blabla PNG 5 5 10 3600 86400 foobar,foobarbaz,foo,bar ^(?!.*\.\.)[a-zA-Z0-9\./]*\.map$ 0/5000/1000 Services ================================================================================ Services are the type of request that mod-mapcache will respond to. You should of course enable at least one. .. code-block:: xml assemble bilinear myjpeg Miscellaneous ================================================================================ .. code-block:: xml JPEG report /tmp 10000 warn true