User:G0ldfish/Garmin maps from ASTER data

From OpenStreetMap Wiki
Jump to: navigation, search

Download the ASTER DEM tiles (GEOTIFF files) from

Unzip them and put all TIF files covering the area in question into a directory. For the canary archipelago, I decided to combine the western island (El Hierro, La Palma, La Gomera) into one shapefile, the larger central islands (Tenerife, Gran Canaria) into seperate shapefiles each and the eastern islands (Fuerteventura, Lanzarote) into a forth shapefile to keep the filesize low. Tile ASTGTM2_N28W019_dem.tif which would cover the very western edge of La Palma island is not available from ASTER which meant I had to use a DEM file based on SRTM data instead:

gdal_translate N28W019.hgt N28W019.tif

For each of the directories, you can use

gdalwarp -r cubic dir/*.tif file.tif

to merge them.


gdal_contour -a height file.tif file.shp -i 20

creates shapefiles containing contour lines every 20 meters.

Besides using the shapefiles directly e.g. in QGIS, you can also use ogr2osm to convert the shapefiles to osm-xml, and mkgmap to make Garmin maps with contour lines as described here:

As the shapefiles are differently structured, the resulting osm file is also different. A contour line would be defined e.g. as

<way id="-1" visible="true">
<nd ref="-2" />
<nd ref="-3" />
<nd ref="-4" />
<nd ref="-5" />
<nd ref="-2" />
<tag k="ID" v="0" />
<tag k="height" v="      20.000" />

The corresponding mkgmap style rules:

height ~ '.*[05]00\.0+' 
 { name '${height|conv:m=>ft}' } [0x22 resolution 22]
height ~ '.*[05]0\.0+' 
 { name '${height|conv:m=>ft}' } [0x21 resolution 20]
height ~ '.*0\.0+' [0x20 resolution 20]