Lingua

Login to Openmtbmap

email feed

(English) Create your own Elevation Contourline Maps

I will in future still add some countries (notably Norway), but not many more. Also I will not offer elevation contourlines outside of Europe. If you want to create your own contourline maps, here is a quick overview about the process I used – attention this is an advanced topic and will require you to install quite a lot of software – if you want to get contourlines for a large country (say Norway or France) I advise using x64 systems because on x86 systems you will run out of RAM – I will not provide a German translation here – because if you don't understand it in english, you are unlikely to succeed (all the required programs need basic command of English language):

 

1. Get the coordinates of the left lower (south-west) edge and right upper edge (north-east). The easiest way to get hold of them is to put waypoints with Mapsource. To get the correct format go to preferences in Mapsource, tab position and use Grid: Lat/Lon hddd.dddddd°, datum as always WGS 84.

 

2. Transform the coordinates for srtm2osm. N47.41502 E11.02737 has to be changed to 47.41502 11.02737, S47.41502 W11.02737 becomes -47.41502 -11.02737.

 

3. Get srtm2osm from here: http://wiki.openstreetmap.org/wiki/Srtm2Osm and install it.

 

4. Srtm2osm downloads the needed *.hgt DEM information automatically from Nasa to subfolder srtm/srtmcache if not specified differently. Nasa data is however not very good in mountaineous regions. On viewfinderpanoramas.org you can get much better DEM data. Head over there and download all availble 3" DEM for the region you need (you know the coordinaties from step 2). Place them into subfolder srtm/srtmcache of you srtm2osm installation (create theese folders if they don't exist). Srtm2osm will not download DEM from NASA SRTM if we have placed other data to srtmcache beforehand.

 

5. Call up srtm2osm with the following command (if you don't know where to input this command, I recommend you stop reading here because you will not get far):

srtm2osm.exe -bounds1 57.71690 4.01368 71.19163 31.14427 -cat 400 100 -large -corrxy 0.0005 0.0006 -o no.srtm.osm

- bounds1 57.71690 4.01368 is the lower left edge, 71.19163 31.14427 is the upper right edge

-cat 400 100 specifies the interval for medium and major contourlines to 400 (major) 100 (medium).

-large is needed because big areas will otherwise make you run out of memory instantly.

-corrxy 0.0005 0.0006 is the correction factor I used because the SRTM data seems to be mal aligned/transformed to WGS 84.

-o specifies output file.

This above command would give you osm contourlines for Norway. You would need about 6GB of RAM to run it without swapping. The smaller the region, the fewer mountains – the easier the RAM requirements are.

 

6.Optional -  If you want to cut the contourlines around some given shape, i.e. a country boundary instead of the square you got from above, you need to parse the file with osmosis. Install java sdk and osmosis (attention, this is not easy, best do it on Linux systems because with Windows it's messy) and run the following command:

java -Xmx1500M -jar osmosis.jar –read-xml enableDateParsing=no file="no.srtm.osm" –bounding-polygon file="norway.poly" –write-xml file="nocut.osm"

-Xmx1500M specifies that you give 1500 MB of RAM to osmosis.

file=* specifies your file from step 5.

–bounding-polygon specifies your boundary polygon. Geofabrik lists the boundary polygons they use here: http://download.geofabrik.de/readme.html so I advise you to use the same data.

Note that around the boundaries you are likely to get artefacts because osmosis closes the contourlines at the boundary – I don't know how to circumvent this (the command parameters to solve this did not work for me, nor for others according to mailing list talk I found – as of 20. September 2009)

 

7. Split the resulting file (either from step 5 or 6) with mkgmap splitter with the following command (note you need to have Java SDK installed):

–cache=folder (you have to create this subfolder in mkgmap directory) is given to speed up splitting if we notice that the maxnodes are to high.

–max-nodes=* specify the tile size. if 7500000 gives you "not enough space in .img" in step 8 you need to reduce this.

–mapid=%mapid% here functions as a placeholder for a 4 digit number. I advise you to use the %mapid% of the resulting openmtbmap country plus 1000. so for norway this would be 74010000

–mixed has to be given when splitting the output from srtm2osm.

 

 

Step 7 is not needed for very small areas – e.g.  the Netherlands.

%country%*.osm specifies the input file (output file from step 5 or 6)

 

8. Run mkgmap on the resulting output files of step 7. (again Java SDK needs to be installed).

–max-jobs=1 is given to restrict mkgmap to use only one CPU core. Calculate that you need up to 3GB of available RAM per Core if you want to increase here (you could decrease the max-nodes in step 7 if you get "out of memory" error here.

–mapname should be higher by 1000 in comparison to the tiles that you need the contourlines for. If this is lower, the contourlines will be displayed behind the maps in Mapsource – hence only visible on GPS.

–style-file=srtm get my srtm style-file from here and put it into mkgmap folder.

 

9. Optional – If you want to delete the worst artefacts from step 5, you can do so with gpsmapedit, save the corrected files to .mp (polish map) format and recompile with mkgmap

Leave a Reply