Device notifier script for updating OSM map on Garmin device

December 30, 2009

I am regularly mapping things in Openstreetmap with my Garmin Nüvi 205 and a second GPS Tracker (iBlue 747a+).

It is very usefull to have a current version of the OSM map on the Garmin device, so that you see what is actually missing in the map when you are in the field.

I used to manually download the map file from and then uncompressing it to the garmin device. But I was getting tired of doing this repetitive task and so I wrote a script for this….

The script can be executed via the device notifier in KDE4 (more infos about device notifier can be found in an older blogpost of mine: Adding actions to the Device Notifier widget in KDE 4.3).

After selecting “Update OSM map on Garmin device” in the device notifier the script downloads the map and shows a progressbar.

When it is finished a pop-up appears and the device can be removed via device notifier.

I have attached the script (  and the device notifier config (update_map.desktop) to this post.

The script needs the package “pv” (pipe viewer). It can be installed in kubuntu with “apt-get install pv“. (place it in /usr/local/bin)



echo 0 > $progressfile

function watch_progress {
while [ true ]
sleep 1
# check if dbus object exists
qdbus $dbusRef 1>/dev/null 2>&1
if [ “$?” -ne “0” ]
# dbus Object does not exist (anymore)
exit 0

# read current progress
progress=`tail -n1 $progressfile`

# set progress to progressbar
qdbus $dbusRef Set “” “value” $progress


if [ ! -d $target_dir ]
kdialog –msgbox “$target_dir does not exist!”
exit 1

kdialog –yesno “Update OSM Map on $target_dir ?”

if [ “$ret” -eq “0” ]

# get file size
size=`curl -sI $url | grep Content-Length | cut -d ‘ ‘ -f 2 | sed “s/[^0-9]//g”`

dbusRef=`kdialog –progressbar “Downloading OSM Map” 100`
watch_progress “$dbusRef” &

wget -qO- $url | pv -s $kbsize -n 2>$progressfile | bunzip2 > $target_file

qdbus $dbusRef close
rm -f $progressfile

#check return codes in pipe
for rc in ${PIPESTATUS[*]}

if [ “$rc” -ne “0” ]

if [ “$error” -ne “0” ]
kdialog –msgbox “There was an error updating the map”;
kdialog –msgbox “The map was updated successfully – You may now disconnect the device”;

kdialog –msgbox “cancelled…”

update_map.desktop (place it in e.g. /usr/share/kde4/apps/solid/actions)

[Desktop Entry]
X-KDE-Solid-Predicate=[[ StorageVolume.ignored == false AND StorageVolume.usage == ‘FileSystem’ ] OR [ IS StorageAccess AND StorageDrive.driveType == ‘Floppy’ ]]

[Desktop Action open]
Name=Update OSM map on Garmin device
Exec=/usr/local/bin/ %f

Openstreetmap event calendar on a map

November 18, 2009

As someone who is interested in Openstreetmap I’d like to know when an OSM-event takes place somewhere near me.

There is an event calendar on the OSM wiki where people publish the dates of OSM mapping parties and other osm meetings.

It is nice that there is a central place where to look for such meetings. The problem with this list is however, that events all around the world are shown there and it is not easy to find events that take place in a specific region.

The only way to limit the events by a region is to use an iCal feed for a specific region. The region must be supplied in coordinates (,51.278,0.251,51.745)  and you need a client to display the ics data. Most people won’t use this feature.

In my opinion the best place for this OSM event calendar would be an OSM map. So I decided to put the events as markers on an OSM map. Displaying maps and adding markers is really easy thanks to All you need is a bit of javascript and a text file containing the markers.

The hard thing is to get the coordinates of the events. For this task I coded the following in perl.
The events in the calendar usually only contain short descriptions of the events and a link to a more detailed page (e.g. Nov 17 München monthly meeting). I first tried to get the coordinates from the city names. Such a feature is provided by  nominatim. You can query the service by http GET requests and the answer can be return in JSON format (e.g.ünchen+Germany&format=json). This worked quite well with names that are unique, but it is impossible to decide which coordinates are correct if multiple results are returned.
To get the coordinates anyway I did a trick. Each event usually links to a page in the OSM wiki where more details to this event are displayed. Usually these wiki pages contain maps showing the region where the event takes place. In the soucecode of the wiki page you find the coordinate of the region by searching for the strings “lon=” and “lat=”.

This is how the map looks like:

A working version of the map can be found here

I know that the map is not perfect. It is just hacked together in a couple of hours. There probably a lot of bugs in the map (e.g. special characters are not shown correct,…) and not all coordinates are correct. But I think you get a nice overview of where events take place and which of the events are in the near future.

I hope this example shows that it would be nice to have this feature in the OSM wiki or maybe even on the official map (to get more people in touch with the OSM community). This could be implemented very easily if all events would have been provided with coordinates. Maybe a good way to implement this would be via GeoRSS. An example can be found at the openlayers website.

iCal feed

Digikam 1.0.0-beta5 verwendet Openstreetmap Karten

November 3, 2009

Digikam kann schon ein ganze Weile Fotos auf einer Karte darstellen. Hierfür gibt es die Geolocation Ansicht, welche auf marble aufsetzt. Bisher wurde an dieser Stelle eine ungenaue und wenig detailierte Karte angezeigt. In der aktuellen Version können die Fotos nun auch auf der Openstreetmap Karte dargestellt werden.


Beim herauszoomen aus der Karte werden nebeneinander liegende Bilder zu einem einzelnen zusammengefasst. Auf diesem wird wiederum die Anzahl der zusammengefassten Bilder angezeigt.  Somit wirkt die Karte auch dann nicht überladen, wenn sehr viele Fotos in einem kleinen Gebiet geschossen wurden.

Besonders praktisch finde ich, dass man das Feature mit der digikam Suche kombinieren kann. So kann man sich ganz einfach anzeigen lassen, wo man an einem bestimmten Tag gewandert ist (siehe Screenshot) oder sich z.B. alle mit “Strand” getaggten Fotos auf der Karte anzeigen lassen.


Ein Feature vermisse ich leider noch in der Kartenansicht: Praktisch fände ich es, wenn beim Klick auf ein Foto in der Karte das Foto vergrößert dargestellt würde. Leider passiert beim Klicken auf ein Bild im Moment gar nichts.
Ich werde gleich mal auf einen Feature Request eintragen (

%d bloggers like this: