Using TileMill with OpenStreetMap data

After you install TileMill, you want to have some data to play with. OpenStreetMap is a great source of freely licenced geo-data for making maps. Probably the easiest to is use the SHP files that Geofabrik provide. Starting off at downloads.geofabrik.de/osm, find the country/area you're interested in and download the file that ends in .shp.zip. (For example here's the ireland shape file). Unzip that file. There will be many files in there, one of which is roads.shp, which represents all the roads.

Go to your TileMill install ( http://localhost:8889/ ), and create a new project. Click to add a layer. Select 'File', and for Datasource, enter in the full path of the roads.shp file. Choose a good name for the ID, e.g. roads. Click Save.

You now have a layer added, but you aren't displaying it. The default style looks something like this:

Map {
  background-color: #b8dee6;
}

#countries {
  ::outline {
    line-color: #85c5d3;
    line-width: 2;
    line-join: round;
  }
  polygon-fill: #fff;
}

Add in the following text at the bottom:

#roads {
   line-width: 2;
}

Then click Save on top-middle of the page (It took me a while to figure out how to make it show up.)

You should now see all the roads on your map!

Comments !

blogroll