Publish your MBTiles map with Mapcache

I recently tested a feature of MapCache that can let you publish an MBTiles map build with TileMill but without TileStream Server.   So all you have to do is to install Apache module Mapcache from Mapserver web site, add your mbtiles map in your config file and publish your map with OpenLayers.  I use this tutorial to install MapCache it from trunk.

My Mapcache config for my hexagonal GHS map is here.
<cache name="mbtiles" type="mbtiles">
<tileset name="gazemi">

I specified a predefined grid "g" as the default "GoogleMapsCompatible" grid. You don't have to specified this gridset it in your mapcache.xml config file.  Look in the mapcache.xml.sample to find out the complete specification of this predefined grid.

In OpenLayers, I use a WMTS Layer for my MBTiles map.
var wmts = new OpenLayers.Layer.WMTS({
 name: "Gas emission (MBTile)",
 url: "",
 layer: "gazemi",
 matrixSet: 'g',
 format: 'image/png',
 style: 'default',
 maxExtent: new OpenLayers.Bounds(-20037508.342789,-20037508.342789,20037508.342789,20037508.342789),
 projection: new OpenLayers.Projection("EPSG:900913".toUpperCase()),
 sphericalMercator: true

This is the same mbtiles file but publish with TileStream server.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current month ye@r day *