OpenStreetMap

It's been a while since I posted anything new here... but that doesn't mean I've been resting. Today I updated TopOSM - my OSM-based topo map project - with a few nice new features:

I created a Python script to generate map legend HTML snippets - complete with images - from mapnik description files and a short description file that specify what features to include. You can see the result at http://toposm.com/ma clicking on the "Show/Hide Legend" at the bottom right. Legends are specific to the current zoom level, so they will refresh when zooming in and out.

I also added elevation labels for contour lines. The only issue is that the data from MassGIS (where the contours come from) is in meters (3 meter interval) and my map is entirely in ft, so the values look a bit funky sometimes. Not much I can do about that, though...

Lots of minor other improvements too. There's a full changelog http://toposm.com/changelog.html

As always, the map is at http://toposm.com/

Discussion

Comment from acrosscanadatrails on 25 June 2009 at 06:22

Wow, that looks great!
Thats a neat legend feature.

Cheers,
Sam Vekemans
Across Canada Trails

Comment from ColinMarquardt on 25 June 2009 at 20:54

This legend-extractor script of yours is very interesting. Are you releasing the source? It could even live in Mapnik SVN or mapnik-utils at least...

And the map looks even more awesome now!

Cheers
Colin

Comment from Ahlzen on 25 June 2009 at 21:15

Thanks both of you!

Colin: Sure - if there is interest, I'll definitely release the source. It's a bit of a hack, but it's not too terrible. :) Although, I think I saw something on one of the mailing lists recently about someone just implementing the same type of thing for the main mapnik layer (and the "Map key" on the OSM website was indeed recently updated).

Comment from ColinMarquardt on 25 June 2009 at 21:51

The dynamic map key on the OSM site is indeed very new, but updated manually. For this, your script would get a different backend to write the yml file format directly I suppose.
I am very interested in the script for my own Mapnik rendering project (http://opentiles.com/cmarqu/) - right now, I'm rendering a faux map with the interesting features, but that has lots of problems.

And FWIW, http://trac.mapnik.org/wiki/Legending now also has a link to this post. :)

Cheers
Colin

Comment from IgnoredAmbience on 25 June 2009 at 22:20

I've seen a couple of mapnik legending scripts in the past, I think one was written by Jochen Topf in XSLT, and another started by Chris Schmidt in python, unfortunately, I don't currently have either to hand.

Comment from IgnoredAmbience on 25 June 2009 at 22:27

Here's the XSLT one, it gives a lot of detail, and could probably be reduced down to just what's needed: http://geo.topf.org/mapnik/osm.xml

Comment from ColinMarquardt on 25 June 2009 at 22:53

The second one is http://crschmidt.net/osm/mapnik/legend I suppose? I also remember the first one, but it too was far from an automated solution.

Comment from Ahlzen on 26 June 2009 at 15:56

It seems like the thing for me to do is to post the script along with a description of what it does and doesn't do. For now, the TopOSM wiki page on openstreetmap.org will probably be the place to put it.

As for those other scripts suggested above: I've looked at these before, and they're probably good for reference when hacking Mapnik style files. They will list every rule in every style for every data source, rather than the entities that most humans will consider for inclusion on a map key, however, so I think they'd have to be pretty heavily modified to be useful for something like this.

Colin: Your approach of creating a "fake" map and render it is interesting. I actually considered that too, but it seemed like maintenance would be an issue. Especially if one, like me, wants it customized per zoom level.

Comment from ColinMarquardt on 27 June 2009 at 18:06

Thanks very much for the script, will try it soon on my map.

Log in to leave a comment