Posts tagged ‘openlayers’

Running my own OpenStreetMap server

UK map generated on my OSM server

UK map generated on my OSM server

After using OpenStreetMap in a fairly limited way for the past year or so, essentially just to upload data/tracks from wandering around Ethiopia, I thought I’d have a closer look, especially as a possible replacement for Google Maps which I was using a lot whilst at the OU.

Firstly I looked at how I could use OSM and the OpenLayers API as an alternative for the map in my Online Users Map – which certainly looks feasible. So I’m now thinking about making this an option in the block settings, as shouldn’t be too much work to provide the option.

I also set up my own open street map server (instructions for installing on Ubuntu Lucid Lynx). Although quite a long process everything worked well first time with no errors. I didn’t download the entire 8Gb+ OSM dataset to generate my tiles, rather I just selected a much smaller area of detailed data (using extracts from GeoFabrik and CloudMade). This avoided the potential ’30 hours or longer’ process of importing the world into my database – the whole dataset for Ethiopia took less than 30 seconds to import.

The only part where I ran into a problem was at the very end when I wanted to generate all the tiles. When I ran ./ I kept getting an error telling me that osm-local.xml didn’t exist. Fortunately this was quite an easy fix, I just needed to edit ~/bin/mapnik/ to point to ~/bin/mapnik/osm.xml instead, then all ran fine (generating 55Mb+ of png images).

I could then create an alias in my Apache to point to my generated tiles and create a slippy map using OpenLayer and the tiles generated on my desktop.

I still have a lot to learn about all this, especially with what can be done with Mapnik for generating tiles (and the python script necessary to achieve it) and using OpenLayers as a replacement for Google Maps API – but all going well so far 🙂