logo separator

[mkgmap-dev] Creating a map with contour lines and DEM

From Bernhard Hiller bhil at gmx.de on Tue Feb 13 18:38:27 GMT 2018

I was trying to create a map of Taiwan including DEM data and elevation 
contour lines. The DEM part was easy. But strangely, I cannot get 
elevation contourlines.

I downloaded hgt data from Viewfinder Panoramas, and placed them into 
the cache directory of srtm2osm.
I called srtm2osm in a batch file:

SET SRTM="C:\Program Files (x86)\OpenStreetMap\Srtm2Osm\Srtm2Osm.exe"
SET OUTPUTDIR=E:\Maps\Raw\Taiwan.DEM\

%SRTM% -bounds1 21.81 120 23.6 122.1 -o %OUTPUTDIR%TaiwanS.osm
%SRTM% -bounds1 23.59 120 25.4 122.1 -o %OUTPUTDIR%TaiwanN.osm

TaiwanS mearures 1554993 kB, TaiwanN 2249418 kB (I must do it in 2 
parts, otherwise the program uses more than 7 GB of RAM and causes lots 
of paging).
Next, I sorted one of the files with osmosis (originally I sorted and 
merged both of them, and then merged with an extract from Geofabrik; 
that's what I plan to do when I got things working...):

SET OSMOSIS="C:\Program Files 
(x86)\OpenStreetMap\osmosis-0.46\bin\osmosis.bat"
SET INPUTDIR=E:\Maps\Raw\Taiwan.DEM\
%OSMOSIS% --read-xml %INPUTDIR%TaiwanS.osm --sort --write-pbf 
%INPUTDIR%Taiwan_Ele.osm.pbf

The output file measures 16670 kB.
Next, I split it with

SET JAVA="C:\Program Files\Java\jre1.8.0_121\bin\java.exe"
SET SPLITTER="C:\Program Files 
(x86)\OpenStreetMap\splitter-r590\splitter.jar"
SET INPUTDIR=E:\Maps\Raw\Taiwan.DEM\
SET INPUTDATA=Taiwan_Ele.osm.pbf
SET NAME="BernieMap Bike Taiwan"

%JAVA% -Xmx6G -jar  %SPLITTER% ^
     %INPUTDIR%\%INPUTDATA% ^
     --description=%NAME% ^
     --max-nodes=2500000 ^
     --no-trim ^
     --mapid=47120001 ^
     --max-threads=4 ^
     --keep-complete=true

which creates 3 pbf-files.
Finally, I build the map with

SET JAVA="C:\Program Files\Java\jre1.8.0_121\bin\java.exe"
SET MKGMAP="C:\Program Files (x86)\OpenStreetMap\mkgmap-r4107\mkgmap.jar"
SET 
PREPROC=E:\Data\Projects\Projects.Net2\StylePreProcessor\bin\Debug\StylePreProcessor.exe
SET STYLE=E:\Maps\Development\Style.Mapnik\Mapnik.Bike
SET DEMPATH=E:\Maps\Raw\Taiwan.DEM
SET NAME="BernieMap Bike Taiwan"
SET TYP=M04712.TYP

%PREPROC% /in=E:\Maps\Development\Style.Mapnik\Mapnik.Base /out=%STYLE% 
/defines=BIKE,THAI
copy E:\Maps\Development\Style.Mapnik\%TYP% %TYP%
copy "C:\Program Files (x86)\OpenStreetMap\GMT\gmt.exe" gmt.exe
gmt.exe -wy 4712 %TYP%

%JAVA% -Xmx6G -ea -jar %MKGMAP% ^
     --style-file=%STYLE% ^
     --family-name=BernieMapTaiwan ^
     --family-id=04712 ^
     --product-id=1 ^
      --description=%NAME% ^
     --series-name=%NAME% ^
     --name-tag-list=name:en,int_name,name ^
     --latin1 ^
     --add-pois-to-areas ^
     --route ^
     --location-autofill=bounds,nearest ^
     --preserve-element-order ^
     --draw-priority=25 ^
     --index ^
     --nsis ^
     --show-profiles=1 ^
  --generate-sea=multipolygon,extend-sea-sectors,floodblocker ^
     --max-jobs=4 ^
     --dem-poly=areas.poly ^
     --x-dem=%DEMPATH% ^
  --x-dem-dists=3314,4000,6000,8000,10000,15000,20000,30000 ^
     --gmapsupp 4*.osm.pbf ^
     %TYP%

move gmapsupp.img E:\Maps\Use\Taiwan.IMG

which creates an IMG file of 18798 kB.
It is recognized by my Oregon 600.
In the demo mode, I navigate to a waypoint (Luigui, 22.99573 N, 
120.63496 E).
I expect to see a map of contourlines only. But I get a completely white 
map.
Elevation from DEM is 250m directly adjacent to the waypoint, and other 
sensible values nearby.

The style file contains:
contour=elevation & contour_ext=elevation_major & (ele > 0 | ele < 
0)         { name '${ele|conv:m=>ft}'; }           [0x20 level 4]
contour=elevation & contour_ext=elevation_medium & (ele > 0 | ele < 
0)        { name '${ele|conv:m=>ft}'; }           [0x21 level 2]
contour=elevation & contour_ext=elevation_minor & (ele > 0 | ele < 
0)         { name '${ele|conv:m=>ft}'; }           [0x22 level 0]

The TYP file (created and compiled with MapTk) contains:
[Polyline]
Type=0x20
String=0,Höhenlinie
String=4,Elevation
Color=0,0x000000
Line=00..00
[END]

[Polyline]
Type=0x21
String=0,Höhenlinie
String=4,Elevation
Linewidth=1
Color=0,0x000000
[END]

[Polyline]
Type=0x22
String=0,Höhenlinie
String=4,Elevation
Linewidth=2
Color=0,0x000000
[END]
which should cause black elevation contour lines.

What do I do wrong?

Thanks a lot for your hints.

Kind regards,
Bernhard


More information about the mkgmap-dev mailing list