Quite often we need to create a map for a client. Most of these maps are static but some of them are also slippy maps, like google maps. Creating these maps is a lot of work, depending on the level of detail and the scale. Nevertheless, we tend to do them by hand, over and over again. Normally we download data from openstreetmap and edit that. A good place to start is http://download.bbbike.org/osm. Generally speaking, the results are great, but take a lot of manual labor to create. “This should not be so hard” I thought to myself. And of course, other people thought the same before me and did something about it. They call it Mapbox and Tilemill.
When using tilemill, we can create maps more efficiently and make them pretty at the same time. It’ll also save time in the long run, since a lot of the styling you do in tilemill is recyclable. Tilemill uses a type of css coding to style the maps. Anyone familiar to css should be able to pick this up fairly quickly. You need to import data first, since tilemill doesn’t provide that by default. An obvious choice is data from openstreetmap. But other sources are also possible. Tilemill comes with some data, you can even import georeferenced spreadsheets.
Working with files from openstreetmap is great. Besides the actual shapes it also contains a lot of extra info you can use to style the maps. You can separate main roads from secondary roads, or mark all hospitals with a symbol. Sometimes you need more, or something custom. To edit the data, you need another program, since tilemill doesn’t allow you to change the data in the maps. A good place to start is Quantum GIS (qgis). This program allows you to change the shapes, but also the data. You can also add some data yourself and inspect all the available fields.
Style your map
After you’ve reviewed or edited your data in qgis, you can import it into tilemill. Keep in mind that openstreetmap data is pretty detailed. Importing an entire country with all the layers won’t work, that’s just too heavy. If your working on global or national maps, you really need to refine your data or use other sources. Once you’ve got your maps loaded, you don’t see them directly. This is because you need to style them. Use the carto mss syntax for that. It’s pretty easy to pick up and within tilemill some excellent examples have been added.
When you’re satisfied with your style, you can export it to a static map: pdf, png or svg. Or upload the map to your mapbox account. Alternatively you can host the map on your own server. When exporting to MBtiles, which is needed for the slippy maps, keep in mind that the amount of data can be huge. As the name suggests, the map is exported to a bunch of tiles: images of 256×256 pixels. For each zoomlevel you add, the amount of tiles increases by a factor of four.
I’ll probably talk some more about these maps later, but for now this overview is all. Happy mapping!