Playing with OSM data, in TileMill

I revisted my earlier OSM experiment only using TileMill instead of QuantumGIS to make the map. TileMill has much nicer output, particularly if you want to ship a set of slippy map tiles or frame out specific high quality images / prints. It’s also more of a textual programming kind of paradigm, which I like better. OTOH TileMill also has very specific limits on what it’s capable of doing; it’s not a generic GIS toolset.

It was pretty easy; the hardest part was remembering the weird way to filter a table with select in TileMill; their PostGIS support is a bit idiosyncratic. Also it guessed wrong on the SRS for my tracks; they’re in WGS84 but it was trying to draw them as if they were in Google Mercator, way out of scale. That seems like a bug.

Anyway, I remade my map of my walks around SF, here’s an image and some code.


        "table": "(select * from planet_osm_polygon\n where leisure = 'park'\n  and geometrytype(\"way\") in ('POLYGON', 'MULTIPOLYGON')\n) as parks",
        "table": "(select * from planet_osm_line\n where \"railway\" is null\n) as road",

@road: #444444;
@border: #222222;
@park: rgb(196, 243, 170);
@water: #b8dee6;
@bg: #ffffff;
@track: rgb(237,101,22);

Map { background-color: @water; }

#sanfrancisco {
  polygon-opacity:1;
  polygon-fill:@bg;
  line-width: 2;
  line-color: @border;
}

#tracks {
  line-color: @track;
  line-width: 3.0;
}
#road {
  line-color: @road;
  [highway='motorway'] { line-width: 3.0; }
  [highway='motorway_link'] { line-width: 2.0; }
  [highway='footway'] { line-width: 0.7; line-color: lighten(@road, 20%); }
}
#parks {
  line-color: @border;
  line-width: 1.0;
  polygon-opacity: 1;
  polygon-fill: @park;
}