Creating a map with contour lines and DEM

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a map with contour lines and DEM

Bernhard Hiller
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
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating a map with contour lines and DEM

franco_bez
the easiest way to create a contourlines map is   phyghtmap
<http://katze.tfiu.de/projects/phyghtmap/index.html>  

this tool is for creating osm Files containing the contourlines.

In a second step you build the Garmin map with mkgmap

like this:

phyghtmap --start-node-id=1  -start-way-id=1 --max-nodes-per-tile=1000000
--max-nodes-per-way=250  --jobs=4  --o5m --no-zero-contour -s 50 -c 500,100
hgt_files/*.hgt

java  -jar mkgmap.jar --keep-going --max-jobs  --read-config=options
--style-file=contourlines_style --mapname=65188001
--description=contourlines --family-name=Contourlines --draw-priority=16
--gmapsupp *.o5m

----
options file:
levels = 0:24, 1:23, 2:22, 3:21, 4:20, 5:18, 6:17, 7:16
reduce-point-density=20
transparent
latin1

Ciao,
  Franco




--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating a map with contour lines and DEM

Arndt Röhrig

Hi,

i also use phyghtmap.

I have a problem with bigger maps like "Alpen" or "Europa". max-nodes-per.tile=0 will not work, so i must use the default-value 1000000. Then i get hundreds of files, that is a problem for splitter, cause the option keep-complete=true wil not work.

I put the osm and srtm Data together into splitter, because when i join two separate created maps, the contourlines will be draw over the streets and not behind.


For the some european countrys i have a srtm.pbf files. You can download and use it:

http://www.speichenkarte.de/Bauen.html

Only europe is missing, because it will not work on my old computer. If somebody have fun to help me, i need europe (poly from Geofabrik) with 20, 40, 100 in only one .pbf file :)

For private use (europe) i take the data from Freizeitkarte, but this is 20, 100, 500.

http://develop.freizeitkarte-osm.de/ele_20_100_500/


With a bad trick the lines appear in the map like 20,40,100

contour=elevation & ele=100 { name '${ele|conv:m=>ft}'; } [0x22 resolution 20 ]
contour=elevation & ele=200 { name '${ele|conv:m=>ft}'; } [0x22 resolution 20 ]
contour=elevation & ele=400 { name '${ele|conv:m=>ft}'; } [0x22 resolution 20 ]
contour=elevation & ele=600 { name '${ele|conv:m=>ft}'; } [0x22 resolution 20 ]
contour=elevation & ele=800 { name '${ele|conv:m=>ft}'; } [0x22 resolution 20 ]

.

.

.

contour=elevation & ele=40 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=80 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=120 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=160 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=200 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=240 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]
contour=elevation & ele=280 { name '${ele|conv:m=>ft}'; } [0x20 resolution 22 ]

and so on.....:)


Greets

Arndt


franco_bez hat am 13. Februar 2018 um 21:05 geschrieben:


the easiest way to create a contourlines map is phyghtmap


this tool is for creating osm Files containing the contourlines.

In a second step you build the Garmin map with mkgmap

like this:

phyghtmap --start-node-id=1 -start-way-id=1 --max-nodes-per-tile=1000000
--max-nodes-per-way=250 --jobs=4 --o5m --no-zero-contour -s 50 -c 500,100
hgt_files/*.hgt

java -jar mkgmap.jar --keep-going --max-jobs --read-config=options
--style-file=contourlines_style --mapname=65188001
--description=contourlines --family-name=Contourlines --draw-priority=16
--gmapsupp *.o5m

----
options file:
levels = 0:24, 1:23, 2:22, 3:21, 4:20, 5:18, 6:17, 7:16
reduce-point-density=20
transparent
latin1

Ciao,
Franco




--
Sent from: http://gis.19327.n8.nabble.com/Mkgmap-Development-f5324443.html
_______________________________________________
mkgmap-dev mailing list
[hidden email].org.uk
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating a map with contour lines and DEM

Bernhard Hiller
In reply to this post by Bernhard Hiller
The solution was actually simple: the lines created by Srtm2Osm had a
"contour" tag only, but no "contour_ext" tag.
It is necessary to supply the "-cat" option, together with values for
major, medium, and minor elevation steps.
I.e. I changed the call to
Srtm2Osm.exe -step 25 -cat 500 100 25 -large
and now things work.

Am 13.02.2018 um 19:38 schrieb Bernhard Hiller:

> 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=:\Program Files (x86)\OpenStreetMap\Srtm2Osm\Srtm2Osm.exe"
> SET OUTPUTDIR=\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=:\Program Files
> (x86)\OpenStreetMap\osmosis-0.46\bin\osmosis.bat"
> SET INPUTDIR=\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=:\Program Files\Java\jre1.8.0_121\bin\java.exe"
> SET SPLITTER=:\Program Files
> (x86)\OpenStreetMap\splitter-r590\splitter.jar"
> SET INPUTDIR=\Maps\Raw\Taiwan.DEM\
> SET INPUTDATA=iwan_Ele.osm.pbf
> SET NAME=ernieMap Bike Taiwan"
>
> %JAVA% -Xmx6G -jar  %SPLITTER% ^
>     %INPUTDIR%\%INPUTDATA% ^
>     --description=AME% ^
>     --max-nodes%00000 ^
>     --no-trim ^
>     --mapidG120001 ^
>     --max-threads=^
>     --keep-complete=ue
>
> which creates 3 pbf-files.
> Finally, I build the map with
>
> SET JAVA=:\Program Files\Java\jre1.8.0_121\bin\java.exe"
> SET MKGMAP=:\Program Files (x86)\OpenStreetMap\mkgmap-r4107\mkgmap.jar"
> SET
> PREPROC=\Data\Projects\Projects.Net2\StylePreProcessor\bin\Debug\StylePreProcessor.exe
> SET STYLE=\Maps\Development\Style.Mapnik\Mapnik.Bike
> SET DEMPATH=\Maps\Raw\Taiwan.DEM
> SET NAME=ernieMap Bike Taiwan"
> SET TYP=4712.TYP
>
> %PREPROC% /in=\Maps\Development\Style.Mapnik\Mapnik.Base /out=%STYLE%
> /defines=KE,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=TYLE% ^
>     --family-name�rnieMapTaiwan ^
>     --family-id712 ^
>     --product-id=^
>      --description=AME% ^
>     --series-name=AME% ^
>     --name-tag-list=me:en,int_name,name ^
>     --latin1 ^
>     --add-pois-to-areas ^
>     --route ^
>     --location-autofill=unds,nearest ^
>     --preserve-element-order ^
>     --draw-priority% ^
>     --index ^
>     --nsis ^
>     --show-profiles=^
>  --generate-sea=ltipolygon,extend-sea-sectors,floodblocker ^
>     --max-jobs=^
>     --dem-poly=eas.poly ^
>     --x-dem=EMPATH% ^
>  --x-dem-dists314,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=evation & contour_ext=elevation_major & (ele > 0 | ele <
> 0)         { name '${ele|conv:m=t}'; } [0x20 level 4]
> contour=evation & contour_ext=elevation_medium & (ele > 0 | ele <
> 0)        { name '${ele|conv:m=t}'; }           [0x21 level 2]
> contour=evation & contour_ext=elevation_minor & (ele > 0 | ele <
> 0)         { name '${ele|conv:m=t}'; } [0x22 level 0]
>
> The TYP file (created and compiled with MapTk) contains:
> [Polyline]
> Type=20
> String=Höhenlinie
> String=Elevation
> Color=0x000000
> Line
> [END]
>
> [Polyline]
> Type=21
> String=Höhenlinie
> String=Elevation
> Linewidth=
> Color=00x000000
> [END]
>
> [Polyline]
> Type=22
> String=Höhenlinie
> String=Elevation
> Linewidth=
> Color=00x000000
> [END]
> which should cause black elevation contour lines.
>
> What do I do wrong?
>
> Thanks a lot for your hints.
>
> Kind regards,
> Bernhard
>

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating a map with contour lines and DEM

Eugeny_B
In reply to this post by Arndt Röhrig