wiki:UserGuidelinesGISDataOpenStreetMapGarmin

Version 19 (modified by Fran Boon, 14 years ago) ( diff )

Srtm2Osm on Linux

Garmin Base Map

OpenStreetMap data can be downloaded to a Garmin GPS:

Some areas already have this done for you:

Download the data for the area that you're interested in.

Easiest way for small areas is using JOSM & save it as filename.osm

For larger files use http://wiki.openstreetmap.org/index.php/Osmxapi

Calculate the bounding box (Decimal degrees, S & W are negative. Use Google Earth's 'Grid' View to help)

wget -O filename.osm http://www.informationfreeway.org/api/0.5/*[*=*][bbox=min_long,min_lat,max_long,max_lat]

e.g. for Tanzania:

wget -O tanzania.osm http://www.informationfreeway.org/api/0.5/*[*=*][bbox=29,-12,41,-1]

e.g. for Liberia:

wget -O liberia.osm http://www.informationfreeway.org/api/0.5/*[*=*][bbox=-11.5,4.3,-7.35,8.6]

or get a planet.osm file from:

UTFSanitizer

This may need to be cleaned-up using UTF8sanitizer

Linux

NB Can ignore errors in other apps

apt-get install libmysqlclient-dev
svn co http://svn.openstreetmap.org/applications/utils/planet.osm/C/
cd C
make
./UTF8sanitizer <filename.osm >fixed.osm 2>errors.txt

Windows

Needs to have Cygwin1.dll present

mkgmap

Use mkgmap to convert this to be usable on the Garmin:

java -jar -Xmx512M mkgmap.jar fixed.osm

This will produce a file called 63240001.img. This can be copied to the CF card as Garmin/gmapsupp.img (Put the Garmin into 'Mass Storage' mode to get it to act as a CF card reader)

For more help see: http://wiki.openstreetmap.org/index.php/Mkgmap/help

Troubleshooting

If you get :

Error at line 216, col 6
Bad file format: c:\Temp\cut\63242591

then open the file & remove the repeated header from the file!

If you just get:

Bad file format: c:\Temp\cut\63242591

then open the file & convert to UTF-8 (Format menu in notepad++, if too large & it crashes, then use Cygwin/Linux:

iconv -f ISO-8859-1 -t UTF-8 filename > output)

UK

If downloading the whole of the UK (from http://nick.dev.openstreetmap.org/downloads/planet/) then this is too large to process in 1 go, so the file needs splitting.

New, untested method:

Old, tested method:

UTF8sanitizer.exe <uk-*.osm >fixed.osm 2>errors.txt
md cut
java -Xmx1024M -jar osmcut.jar 2 fixed.osm cut

cygwin:

for i in cut/*; do iconv -f ISO-8859-1 -t UTF-8 "$i" > "${i}.utf8"; done
java -jar -Xmx1024M mkgmap.jar cut/*.utf8
java -jar -Xmx1024M mkgmap.jar --gmapsupp 6*.img

To update a gmapsupp.img, rename it as e.g. old.img, & build the new .img via:

java -jar -Xmx1024M mkgmap.jar --gmapsupp latest.osm old.img

MapSource

The map can be made visible in MapSource using a .reg file like this one (copy the 6*.img & the 6*.tdb to c:\garmin\osm):

  • OSM.reg (attached)

NB MapSource 6141 - 6156 are broken - use 6137 for now

Osmosis

wget http://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-latest.zip
mv osmosis-latest.zip osmosis-0.38.zip
unzip osmosis-0.38.zip

To split off a smaller area from a larger osm file, use Osmosis (NB Need Osmosis-0.35 since Srtm2Osm only support API 0.5 currently!):

(2pts.txt files available from http://www.maproom.psu.edu/dcw/)

Contours

To add Contour lines to the .osm files before converting to .img:

Running on Linux:

  • currently fails: "The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the `/usr/lib/mono/1.0/mscorlib.dll' directory."
    apt-get install mono-runtime libmono-corlib2.0-cil libmono-system-runtime2.0-cil libmono-system2.0-cil libmono-i18n2.0-cil
    wget http://topo.openstreetmap.de/Srtm2Osm-1.8.14.10.zip
    unzip Srtm2Osm-1.8.14.10.zip
    cd Srtm2Osm
    mono Srtm20sm.exe
    

e.g. for Haiti:

srtm2osm -step 25 -cat 250 100 -bounds1 17.884659 -74.668579 20.231275 -71.6584 -o haiti_contours.osm
osmosis --rx haiti_contours.osm enableDateParsing=false --sort --rx haiti.osm --merge --wx outfile.osm
osmosis --read-xml-0.5 haiti_contours.osm enableDateParsing=false --sort-0.5 --read-xml-0.5 haiti.osm --merge-0.5 --write-xml-0.5 outfile.osm
java -jar -Xmx2048M mkgmap.jar outfile.osm
java -jar -Xmx1024M mkgmap.jar --gmapsupp 6*.img

e.g. for Liberia:

srtm2osm -large -cat 500 100 -bounds3 "http://openstreetmap.org/?lat=6.47&lon=-9.35&zoom=8&layers=B00FT" -o liberia_contours.osm

e.g. for Tanzania:

srtm2osm -large -cat 500 100 -bounds3 "http://openstreetmap.org/?lat=-6.89&lon=30.59&zoom=6&layers=B00FT" -o tanzania_contours.osm

e.g. for Darfur:

UTF8sanitizer.exe <sudan.osm >fixed.osm 2>errors.txt
iconv -f ISO-8859-1 -t UTF-8 fixed.osm > sudan.osm
srtm2osm -large -cat 800 200 -bounds3 "http://openstreetmap.org/?lat=11.75&lon=27.37&zoom=7&layers=B000FTF" -o darfur_contours.osm

e.g. merge Kilimanjaro contours into Tanzania OSM:

srtm2osm -step 50 -cat 1000 250 -bounds3 "http://openstreetmap.org/?lat=-3.2&lon=37.2&zoom=9&layers=B00FTF" -merge tanzania.osm

e.g. merge Table Mountain contours into South Africa OSM:

srtm2osm -step 20 -cat 250 100 -bounds3 "http://openstreetmap.org/?lat=-33.93&lon=18.917&zoom=10&layers=B000FTF" -merge south_africa.osm

Can also merge data afterwards using Osmosis:

java -Xmx512M -jar osmosis.jar --rx darfur_contours.osm enableDateParsing=false --sort --rx sudan.osm --merge --wx outfile.osm
java -Xmx512M -jar osmcut.jar 3.5 outfile.osm cut
for i in cut/*; do iconv -f ISO-8859-1 -t UTF-8 "$i" > "${i}.utf8"; done
java -jar -Xmx512M mkgmap.jar cut/*.utf8
java -jar -Xmx512M mkgmap.jar --gmapsupp 6*.img

http://wiki.openstreetmap.org/index.php/Topographic_maps_for_garmin_devices

Alternative method for creating Contour maps which doesn't use OSM:

If in the UK then can use .img files from Scottish Mountaineering Club:

To merge these with the OSM data, ensure both Maps are visible in MapSource, select all the segments (using the 'Map Tool') from each in turn, then 'Send to Device'.

The gmapsupp.img from the SD card can then be copied-back to use elsewhere. or

java -jar -Xmx1024M mkgmap.jar --gmapsupp osm\6*.img contours\*.img

Other sources of refined DEMs:


UserGuidelinesGISData

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.