OSM with grid overlay?

Hopefully there will be a simple answer to this, although I’ve searched and not found one so far.

I’ve been contributing to OSM for my area, but now I want to print some maps to give a wider perspective than my gps screen when I’m out mountain-biking, but I can’t find out how to get a grid overlaid on the image so it is possible to work out my location on the paper map from the displayed coordinates on my GPS. It looks like osmarender can overlay a grid but it appears that this is turned off on The Map. Does anyone know of an existing renderer with grid displayed?

To make the grid usable it needs to have the gridline coordinates printed (e.g. on the edge of the map) as well as the image with gridlines overlaid. Can Openlayers do this?

My personal preference would be for an OSGB grid to be shown, but I’d survive if it were WGS84.

Thanks
Ian

1 Like

I’ve just done a bit of playing about with OpenLayers overlays for the British grid.
Result here: http://osmalba.org/grid/

This is using the British Grid KMZ files from http://nearby.org.uk/downloads.html, for 100km and 10km grid lines. Use the layer switcher to choose (and to set it to default Mapnik instead of Gaelic if you want).
Though this is just grid lines, I don’t know if there’s any way of adding coordinates etc.

Wow, thanks for doing that!

I want a 1km grid (south-east UK will suffice) so it looks like I’ve got to roll my own. I can write a program to generate the kmz file, but I need to know how to setup Openlayers to serve (say) Mapnik data and then overlay my grid kml file on it. Once I’ve got the basics going I’ll be able to try get the coordinates displayed around the map image. Are there any beginners guides to setting up my own version of what you’ve got?

Seperate question: does anyone know if there is an OSM server with the UK in the OSGB projection?

Thanks again
Ian

Ah I just found this http://openlayers.org/dev/examples/graticule.html. Looks like it is possible to get Openlayers to do what I want (in OpenLayer-speack the grid lines are called a graticule), just need to figure out exactly how to get my data source and grid displayed.

Turns out graticule isn’t in OpenLayers 2.8, it’s in the dev (trunk?) build at http://openlayers.org/dev/OpenLayers.js.

I don’t think there is. This question has come up once or twice before.

OK so I took the html delivered by openstreetmap.org for an embeddable iframe (as referred to by the exported embedded html from The Map), modified two lines: change the script line referring to openstreetmap version of openlayers.js, to refer to the development trunk (http://openlayers.org/dev/openlayers.js), and added a new Graticule control to the map, and voila! a basic mapnik map with grid overlay and coordinates displayed.

Html looks like this:

OpenStreetMap Embedded html { width: 100%; height: 100%; } body { width: 100%; height: 100%; margin: 0px; } #map { width: 100%; height: 100%; } .olControlAttribution { bottom: 3px!important; }