Messing about with some Mapping

The topic of mapping has caught my interest recently. Eighteen months ago I had investigated what options were available for offline GPS on my Nokia N95 and found that the offering were very limited. Furthermore, the free coverage of Brisbane on things like Openstreetmap was quite limited.

It would seem however that things have changed significantly since then. We-Travel, a Java based application now provides and options, when used in conjunction with OSM data to have free offline GPS nav on compatible phones. While it isn’t particularly mature, it looks very hopeful. (especially given my three year nokia maps navigation licence will last until next July)

Secondly, it would seem that the quality of the data available through the Open Street Map has improved dramatically. This gave me a bit of motivation to do some mapping around my area but I was quite impressed at how this has progressed since I last looked at it.

I experimented around a bit with making use of this openstreetmap data and created a basic openlayers example which resides at maps.burningsilicon.net which was a bit of fun.

In addition to this, Atlas generation for We-Travel required downloading a large number of OpenStreetMap tiles. Not wanting to do suck bulk downloads from OSM (for a number of reasons) I decided to try generating my own tiles.

The result of this is that through making use of some helpful guides (listed below) and a pre-build VMware Ubuntu Server appliance, I put together a pre-built Virtual Machine which can be used to do your own Mapnik rendering of OSM tiles.

The VM is only a single core implementation but I found that running several instances of it on multi-core computers around my house worked really well. While not quite as fast as running installing it directly on the PC, the performance is more than acceptable for rendering reasonably sized areas. The other massive advantage of using this virtual machine was that I could make use of several computers sit unused throughout most of the day at my home, without the slow process of having to installing and configuring the software or interfering with the existing setup in any way. The installation was quick and simple with each VM beings assigned to render a separate set of tiles, with the results of all of them being combined together at the end…  (I was testing with rendering parts of Australia down to an 18 zoom) After doing this, I can definitely appreciate the reasoning behind the Tiles@Home project for the OSM. (see below for notes on the VM)

Resources:

http://www.openstreetmap.org

http://www.we-travel.co.cc

The view of Brisbane with locally rendered tiles

The view of Brisbane with locally rendered tiles

The pre-built virtual machine for rendering openstreetmap tiles canbe found below

http://maps.burningsilicon.net/resources/ubuntu-server-Mapnik.7z (approx 1.1gb download)

===Notes for the VM===

2009 – Stephen Rothery

==================================
Prebuilt server to generate Map Tiles
==================================
This VMware image has been configured as per the guide found at:

http://weait.com/content/build-your-own-openstreetmap-server

http://weait.com/content/make-your-first-map

All of the tools are installed and working as well as world_boundaries downloaded and installed. (hence the large size of the image)

All that should be required is to download and load the OSM data that you want and set any bounding boxes in the genereate_tiles.py file. (You can likely get an extract for your country from cloudmade)

By default, tiles will be generated in the /home/notroot/mapnik/tiles folder, these can then be placed on any web server, allowing it to serve tiles. (through openlayers or similar)

This has been tested using Vmware player and found to work fine for generating tiles for Australia.

==================================
Networking on the Virtual Machine
==================================

An issue can occur in Linux on VMware regarding networking, arising from the fact that ever time a virtual machine is copied, VMware will assign it’s network card a new MAC address. (a good idea to avoid conflicts)

This can make it such that the eth0 interface may look like it has dissapeared and networking will no longer function.

To fix this, I found that simply deleting this file and rebooting the Virtual Machine is sufficient, this can be done with.

sudo rm /etc/udev/rules.d/70-persistent-net.rules

followed by a reboot.

==================================
Using Osmosis
==================================

While Osmosis is installed in the home directory of this VM, Java has not been installed as I was unsure about whether it would cause issues redistributing this image.

Download java with sudo apt-get install sun-java6-jdk

==================================
Generating a Map
==================================
To generate a map you need to follow several steps, mostly from the 2nd part of the guide found at:

http://weait.com/content/make-your-first-map

Specifically the following steps:
1) Download the OSM data required
2) If you only want a section of the OSM data, Apply bounding box to osm file.
3) Import the data with osm2pgsql
4) Edit generate_tiles.py for the area and zoom that you want
5) Execute the commands to generate your tiles (all of them are needed every time)
source set-mapnik-env
./customize-mapnik-map >$MAPNIK_MAP_FILE
./generate_tiles.py

Switch to our mobile site