Showing posts with label OSM. Show all posts
Showing posts with label OSM. Show all posts

Monday, 25 April 2011

Kefalonia Map

We are going to Kefalonia on our holidays this year, and I usually like to do a bit of OSM mapping when I go somewhere new, and may do some 'armchair mapping' before I go to get a head start, so I thought I would have a look at how well mapped it is.
The answer is not very - there are the main roads, and a few minor roads and footpaths, but not much else - this is a shame because I like to know where things like supermarkets and banks are.  Unfortunately there is not a lot of information available for remote mapping - very few GPS traces, and Bing Imagery does not cover the area I am interested in.
So instead I decided to make myself a map of the island showing what is there (in OSM anyway).  Because there is not a lot of detail, I want to have contours so I can tell where the mountains are, and also highlight what points of interest there are at lower zoom levels than the standard OSM style.   These are my notes on how I produced the map, so I can remember next time I need to do it.


  • The map bounding box was found by looking at the (lon,lat)  readouts on http://www.informationfreeway.org to check the bottom left and top right of the island.  They are (20.33, 38.03) and (20.82,38.50).
  • I downloaded the OSM data from the mapquest XAPI server using: 
wget http://open.mapquestapi.com/xapi/api/0.6/map?bbox=20.33,38.03,20.82,38.50 -O kefalonia.osm

  • Imported the data into postgresql database using:
osm2pgsql -s -S default.style -d kefalonia -m kefalonia.osm

  • Downloaded the SRTM elevation data covering the island from http://dds.cr.usgs.gov/srtm/version2_1/SRTM3/Eurasia/ - only needed one file (N38E020.hgt.zip), because it is a small island.
  • Generated the contours and imported them into my postgresql kefalonia database as described in http://wiki.openstreetmap.org/wiki/Contours
  • Modified the standard osm mapnik style file as described in http://wiki.openstreetmap.org/wiki/Contours, using the 'PostGIS' method.
  • Generated the map image using the generate_image.py file from the OSM mapnik archive.  I initially had some trouble with no roads appearing, but solved this by re-compiling osm2pgsql from the latest sources - I do not know what the problem was.
  • Having done that, I get this map image:



Kefalonia Map - Version 1 (25 April 2011)
Next I wanted to add a 1km grid to the map to make it easier to judge scale..."are we nearly there yet?" etc.
I did this by adopting the generate_graticule script from mapnik-utils to produce a grid on the google spherical mercator projection (=SRS 900913).  I must admit to not really knowing how this works, but my updated version (generate_grid.py) is in my SVN repository.   I added this to the map by creating an extra xml include file to define the grid layer and style (inc/grid.xml.inc), adding this to layers.xml.inc, and finally defining the layer in osm.xml.

The result (Version 2) is shown below:
Kefalonia Map Version 2 (26 April 2011)
I created another include file for holiday based points of interests (holiday_pois.xml.inc), added it to layers.xml.inc and again added the actual layer definition to osm.xml.
This gave the following map:
Kefalonia Map Version 3 (26 April 2011)

The final thing I needed was the English spelling adding to the Greek text labels.   I did this by adding name:en to the default.style file used by osm2pgsql and re-importing the OSM data into the database.
The challenge was updating the mapnik style file to use the name:en column - the OSM style files are very complicated with lots of SQL SELECT statements to extract the data out of the database.  I was tempted to do a global replace of 'name' with 'name:en'...but 'name' appears all over the place.
I decided the main thing I wanted with both writing styles were place names and I found the code for them in inc/layer-placenames.xml.inc.
I modified the SELECT statement from a simple 'name' to ,'"name" || ' (' || "name:en" || ')' as name'.  This gives me the greek spelling followed by the english spelling in brackets using the postgresql '||' string concatenation operator.  The result is here:
Kefalonia Map Version 4 (27 April 2011)
I think that is about the finished product - I will have to try printing it to see how it looks, then may need to adjust the image size to suit printing....then do some mapping to add some more POIs - Sacla in the south east of the island should be a lot better by the middle of June....

Thursday, 24 February 2011

Easier Map Creation with OpenStreetMap Data

I have been giving some thought to making the process of creating maps form OpenStreetMap data easier.  The problem is that to use the mapnik map renderer, you need to install quite a lot of tools and set different configuration files before you can even start to create a map.
This means you have to be pretty keen to persevere enough to get to an end result.
I am thinking of creating a service to allow you to bypass the tool installing bits, and concentrate on the setting up of the map configuration, so you can get to a result quicker - see http://wiki.openstreetmap.org/wiki/User:Grahamjones#Speciality%20Maps.

Quite a few of the responses that I got to that proposal were about the lack of good documentation to get people started on the process.  I have had a go at addressing this by putting together a simple overview presentation to go through the main concepts and tools that you need to generate a map using mapnik.   The presentation is on slideshare.net, and should be visible below:

Friday, 21 January 2011

Mapnik Map Rendering

Someone asked a question on the osm-gb mailing list about viewing coverage of waterways - canals and navigable rivers.
We don't seem to have one, so I created one on my http://maps.webhop.net web site.
The trouble with that site is that although it is running on a nice powerful computer (my old laptop), it is behind my domestic broadband service from Virgin Media.   Although this service has a nice fast download speed, the upload speed is very poor ~900 kbps compared to 9600 kbps download.   This makes the web site very slow from the outside world.

I have a little virtual server provided by CloudNext - it is nowhere near as powerful as my own server, and has much less disk space, but at least it has a fast internet connection.

I loaded a british isles extract of OpenStreetMap data into the database - it took a very long time - maybe getting on for 12 hours (not sure when it finished!) - my server takes about 2 hours.   Performance rendering maps was not too bad though - rendering down to zoom level 14 took about 2 hours, which is respectable.

Just need to get the database updating to keep it up to date, and re-generate changed tiles now....
You can see the difference at http://maps.webhop.net/canals (my home server) compared to http://maps2.webhop.net/canals (the virtual server)

Saturday, 27 November 2010

Townguide - where next?

My townguide map rendering application is about a year old now, but hasn't changed much since last winter.
Waldemar did a lot of work on it for his Google Summer of Code project where he re-hashed the townguide renderer code to make it more modular and produced a django based web front end.
I have not done very well getting this working because I do not understand django well enough to sort out a few minor bugs in it.
Instead I have taken his re-hashed renderer code and developed it further to make it even more modular - as well as 'plugins' for different PDF output formats, there are plugins for the base map and for different map overlays (a grid, custom markers, gpx tracks etc.) [well nearly anyway].  It also uses mapnik2 so can now produce nice high resolution output to make it comparable to the much prettier maposmatic output.

I have been reading a book about django for a few days now (Python Web Development with Django by Forcier, Bissex and Chun) and feel that I should be able to understand both Waldemar's code and the maposmatic version, so I will have a go at the web front end now - there seems little point in developing my clanky php version with these two much slicker front ends available.

Townguide - where next?

My townguide map rendering application is about a year old now, but hasn't changed much since last winter.
Waldemar did a lot of work on it for his Google Summer of Code project where he re-hashed the townguide renderer code to make it more modular and produced a django based web front end.
I have not done very well getting this working because I do not understand django well enough to sort out a few minor bugs in it.
Instead I have taken his re-hashed renderer code and developed it further to make it even more modular - as well as 'plugins' for different PDF output formats, there are plugins for the base map and for different map overlays (a grid, custom markers, gpx tracks etc.) [well nearly anyway].  It also uses mapnik2 so can now produce nice high resolution output to make it comparable to the much prettier maposmatic output.

I have been reading a book about django for a few days now (Python Web Development with Django by Forcier, Bissex and Chun) and feel that I should be able to understand both Waldemar's code and the maposmatic version, so I will have a go at the web front end now - there seems little point in developing my clanky php version with these two much slicker front ends available.

Sunday, 29 November 2009

Town Guide (again)

Progress with the Town Guide program stalled a bit when I went on holiday, then was rather busy at work for a while. I am back to thinking about it now.
The current version has two output modes, HTML and PDF - both are quite crude, but work.
The PDF output uses LaTeX, which seemed like a good idea at the time, but I am struggling because LaTeX thinks it knows better than me what the output is supposed to look like - it keeps putting the tables etc. at the end, rather than where I ask for them.
This means I have two options - either do battle with LaTeX to sort it out, or abandon it and go for a more 'direct' PDF production.
I think that as the output I am producing is short and simple, I may as well go for 'direct' production. I am going to have a try with ReportLab's python library (http://www.reportlab.org/oss/rl-toolkit/guide/).
I'll go and read the instructions and see how it goes....

Town Guide (again)

Progress with the Town Guide program stalled a bit when I went on holiday, then was rather busy at work for a while. I am back to thinking about it now.
The current version has two output modes, HTML and PDF - both are quite crude, but work.
The PDF output uses LaTeX, which seemed like a good idea at the time, but I am struggling because LaTeX thinks it knows better than me what the output is supposed to look like - it keeps putting the tables etc. at the end, rather than where I ask for them.
This means I have two options - either do battle with LaTeX to sort it out, or abandon it and go for a more 'direct' PDF production.
I think that as the output I am producing is short and simple, I may as well go for 'direct' production. I am going to have a try with ReportLab's python library (http://www.reportlab.org/oss/rl-toolkit/guide/).
I'll go and read the instructions and see how it goes....

Wednesday, 15 April 2009

What has been happening?

I've been forgetting to update this with what has been happening.

WherewasI now has a Python/GTK front end that allows you to plot your GPX traces on a OpenStreetMap map to see where you were, as well as altitude profiles etc. It could still do with a few more features, but it does most of what I want at the moment.

I have decided to make a concerted effort to finish off mapping Hartlepool for OpenStreetMap. The main problem is that am better at cycling around collecting GPX traces than I am at recording the street names. This means I end up with lots of roads with no names - no use if anyone wants to search for an address....To do this I decided to use audio mapping by recording audio clips with my mobile phone. The clips are GeoTagged using data from a little bluetooth GPS receiver. I use GPSMid on the mobile phone. Unfortunately it does not produce the GPX file, or the audio clips in the correct format for the JOSM OpenStreetMap Editor. I wrote a little python script to do the conversion so you can see the positions of the audio clips in the JOSM Editor (See the OSM GPSMid Page for details.

What has been happening?

I've been forgetting to update this with what has been happening.

WherewasI now has a Python/GTK front end that allows you to plot your GPX traces on a OpenStreetMap map to see where you were, as well as altitude profiles etc. It could still do with a few more features, but it does most of what I want at the moment.

I have decided to make a concerted effort to finish off mapping Hartlepool for OpenStreetMap. The main problem is that am better at cycling around collecting GPX traces than I am at recording the street names. This means I end up with lots of roads with no names - no use if anyone wants to search for an address....To do this I decided to use audio mapping by recording audio clips with my mobile phone. The clips are GeoTagged using data from a little bluetooth GPS receiver. I use GPSMid on the mobile phone. Unfortunately it does not produce the GPX file, or the audio clips in the correct format for the JOSM OpenStreetMap Editor. I wrote a little python script to do the conversion so you can see the positions of the audio clips in the JOSM Editor (See the OSM GPSMid Page for details.