Automap: a bash script to create a Garmin img map from OSM

Dear all,

I have created a bash script (runs on Linux) that automatically creates a latest-to-the-minute OSM map of your region/country of interest for your Garmin device. It is very easy to use.
It only requires a little editing of the configuration section at the beginning of the script: specifying the map name and continent you want, as well as the version of mkgmap and splitter that are available on their respective websites and then automatically does the rest:

  • downloads map generation tools (mkgmap, splitter, osm*) from their respective sites
  • downloads a map from geofabrik.de: the first time, downloads the full specified map and updates it to latest OSM timestamp. If a map is already present in the directory, it only updates it, using the correct poly file for the map.
  • handles pbf to o5m conversion
  • splits maps using GeoName cities list
  • extracts and preprocesses boundaries (administrative and postal codes)
  • creates a routable map in Garmin format (gmapsupp.img) using your options and style (if you wish to use your own style files, or play with the various mkgmap options, then you need to edit the mkgmap command, but that is all.)

Each time you run it again, it updates your map to the latest OSM changes, without having to redownload the full map. It requires Java to run mkgmap and splitter (openjdk7 works perfectly well) and a compiler (it downloads the osm* tools from source), which are usually installed on your Linux distribution. I was able to run it on Archlinux and Debian, but it should run anywhere.

The code is available there: https://github.com/zebulon2/automap

I hope this will be useful to you.

zeb,

For a test I used a small map and selected ‘slovenia’, so edited the script to use this instead of ‘great-britain’

I grabbed your scripted and on first run I noticed it was trying to use old versions of mkgmap and splitter which are no longer on the server specified.
I changed to the latest mkgmap -r2606 and splitter -r304 and then that part of the script worked fine.

All code files were downloaded and the various files for the map requested, slovenia, including ‘slovenia-latest.osm.pbf’

So, when I next ran the script, I have an error messge from the map updater section,

-----> Updating o5m map
./automap.sh: line 124: ./osmupdate: No such file or directory

I’m guessing it was looking for a files ‘slovenia.o5m’ which there isn’t, but there is a file call ‘slovenia-boundaries.o5m’
As a consequence it produces no Garmin image file.

I’m running Ubuntu 12.10, fully up to date.

I have both openjdk-6-jre-headless version 6b27-1.12.5-0ubuntu0.12.10.1 as well as openjdk-7-jre-headless version 7u21-2.3.9-0ubuntu0.12.10.1.
Plus all the other usual java stuff installed by Ubuntu by default.

Any hints or clues you can give?


Paul

Sorry for this very late answer.
The error you get is that it does not find osmupdate. Normally, the source for osmupdate (and other programs used by my script) should be downloaded and compiled. Have you got a working compiler in your system? You need gcc and the libraries to build programs from source. openjdk is only useful for mkgmap and splitter.
If your compiler is working, you should have an osmupdate.c and an executable osmupdate in the directory where you run automap.sh. Same for osmconvert and osmfilter.