OSM data and TileMill

By peterm, 19 June, 2013

I started with the TileMill support docs (Crash Course and Guides) to get my basic info and configurations. This is some of the best support documentation I've seen. Well written in a step-by-step approach. Admittedly, I need to re-read some sections until it sunk in, but after seeing some demo's by @springmeyer and @ian_villeda at SOTMUS, it started to become more clear.

For my project, I started with exporting a small section of OSM data (a rectangle containing the campus) and using Step 2 of  the OSM Bright Mac OS X Quickstart guide. Using osm2pgsql, I was able to import the OSM file into the PostgreSQL db. This not without some challenges of its own. It seems that my laptop and desktops had different PostgreSQL installs done over the years. On the desktop, I was unable to execute the postgis extension as either myself or as the postgres user. So, I ended up unloading the LaunchDaemon and reinstalling Postgres via Step 0 of the Quickstart guide. I've aslo got a copy of pgAdmin running to let me look into the tables and poke around.

Once the data is in the tables, it's time to do some exploring. This can be done via a tool like TileMill as well as via pgAdmin. The osm2pgsql import creates 4 tables:

  • planet_osm_line
  • planet_osm_point
  • planet_osm_polygon
  • planet_osm_roads

For each of these tables, OSM has data across lots of columns. For exploring purposes, I was using pgAdmin to view the contents of the table. I found that the name column usually had enough data for me to backtrack and figure out how an item was labeled. Using the name column and selecting the row, you can move through the other columns to see how the record has been created. It may have an entry in natural or one of the other columns that will provide the clue you'll need to actually style the element.