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

5 Comments to “Messing about with some Mapping”

  1. By Ayhan, 19/11/2009 @ 1:49 am

    Hi,
    i’ve donwload the ubuntu-server-Mapnik. Can you tell me the Login for ubuntu, please?
    Greatings from Germany
    Ayhan

  2. By Ayhan, 08/01/2010 @ 8:51 pm

    Hi,
    great VM. Thank you.
    I’am getting always Empty Tiles.

    I followed the steps and execute the commands
    (source set-mapnik-env
    ./customize-mapnik-map >$MAPNIK_MAP_FILE
    ./z0_generate_tiles.py)

    The values for the Bounding Box for Great Britian are from the osm file.

    In the STDERR i always get this messages:
    Great Britian : 10 651 508 Empty Tile
    Great Britian : 10 651 507 Empty Tile

    Can you help please?

    Greetings
    Ayhan

  3. By Iteration, 24/01/2010 @ 12:56 pm

    The login details for the Ubuntu Image are:

    username: notroot
    password: thoughtpolice

    The base Ubuntu image was sourced from http://www.thoughtpolice.co.uk/vmware/

    In terms of blank tiles being generated, you might want to double check that you have imported the OSM data for your region. (as per the instructions on http://weait.com/content/make-your-first-map)

    As it stands the image only comes with the world coastlines installed, not all of the OSM data.

    A good way to test is to do some rendering at zoom level 1-5 where the coastlines will give you outlines and detail without needing all of the underlying OSM data.

  4. By Charles, 25/02/2010 @ 5:30 am

    After installing how do i test the application on the browser?

  5. By natevw, 19/05/2010 @ 9:30 am

    Is it just me, or is PostGIS not even installed on this VM? I’m trying to use the src/mapnik/osm2pgsql/osm2pgsql binary to import, and it’s complaining about an unknown PostgreSQL/PostGIS function. (The mapnik/osm2pgsql.py script only worked after a few modifications, and doesn’t seem to be the droid I’m looking for anyway.)

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Switch to our mobile site