OpenStreetMap

A Map Legend

Posted by SomeoneElse on 29 May 2017 in English.

I’ve created a map legend for the map style that I use. It’s a set of map data that can be appended to a rendering database to create a map legend in a blank bit of map (actually in the middle of Australia).

There are currently two parts - linear features and POIs. As far as the map is concerned these are “real POIs” (though they’re never added to OSM itself of course - just added to the rendering database) so you need to zoom in to see some of the POIs such as the one for vending machines, which only appears in this map style from zoom level 19. You could use it with other map styles, but some of the features are dependent on this lua script.

Here’s a preview of what the “roads” part of the legend looks like:

roads

but to use it properly follow the link and move around.

Discussion

Comment from imagico on 30 May 2017 at 06:51

Nice.

This approach however has one big issue - the data is designed for a certain zoom level and the legend does not work when you zoom away from it. For generating a legend this way for all zoom levels you would either need multiple instances of the data at different scales or cut together the legend from different pieces of the rendered map.

Comment from SomeoneElse on 30 May 2017 at 18:09

The “if you move away from it” issue is less of a problem with tabbed browsers everywhere these days; the bigger issue is that there is no one zoom level at which all of the map legend is sensibly visible! Another problem is agressive caching by e.g. mobile web browsers - it can be difficult to persuade an area to redisplay even if reendered on the server.

I’ll probably end up with black boxes around groups of legend items with a label that appears at all zoom levels (saying “zoom in to see more” or similar). It might even be worth having special rendered map features just for the legend (rather than misusing place=locality for some of the names as now).

Even as it is though, it’s hugely useful for QA - I spotted several errors such as “name not displayed” in the style only after I’d created the map legend. As it stands it’s probably only about 20% complete (or maybe 40% complete of style-unique features).

Log in to leave a comment