[MAPS] - Vector maps (with terrain contour lines)

Started by jurajs, April 22, 2012, 16:04:18

0 Members and 5 Guests are viewing this topic.


QuoteMaps for download presented in this post are rarely updated these days, because i became too lame to keep them fresh. :) But don't get upset. You can still find many interesting information, guides, hints and hopefully also latest news in this thread.

For regulary updated vector maps you can:
-  buy them in locus shop directly or also
-  download maps for free from openandromaps.org
(don't forget to buy a beer to kech61, he is doing great job).

Hi there.

Just to use these maps you will need:
- render theme(s) that supports elevation tags (e.g. http://forum.asamm.cz/viewtopic.php?f=40&t=1871)
- vector map made with elevation data (e.g. some maps are available at the bottom of this post in "Maps for download" section)
- thats it !

Short description:
- here I describe briefly how to make mapsforge vector map(s) using original osm data along with srtm terrain elevation data. Final map tiles will be generated also with fancy terrain contour lines.
- i will share here also download links for some maps, so you can test/use it by yourself
- there are also themes available (read below)

Themes supporting these maps:
. [Theme] osmarender + terrain contours rules <!-- m -->http://forum.asamm.cz/viewtopic.php?f=40&t=1853<!-- m -->
- [Theme] Volatile <!-- m -->http://forum.asamm.cz/viewtopic.php?f=40&t=1868<!-- m -->
- [Theme] Hiking <!-- m -->http://forum.asamm.cz/viewtopic.php?f=40&t=1871<!-- m -->
- [Theme] only_contours <!-- m -->http://forum.asamm.cz/viewtopic.php?f=40&t=1894<!-- m -->

Guide to make your own map (v0.4_2012-05-08):
As an example i will write here how I managed to create a map of Slovakia as this was my really first more or less successfull attempt <!-- s;-) -->;-)<!-- s;-) -->

1. download and install osmosis, phyghtmap, mapsforge mapwriter plugin, srtmfill. get some osm map data from e.g. osm/cloudmade/geofabrik including polygon files, but I preffer my own "handmade" polygons with the smallest complexity possible for better processing speeds.
(computing time increases rapidly with complexity of polygon files, i don't recommend using files with size > 5KB)

2. download "tag-mapping.xml" and add there these lines. (needed for mapwriter)
   <!-- Elevation TAGS -->
      <osm-tag key="contour_ext" value="elevation_minor" zoom-appear="12" force-polygon-line="true" />
      <osm-tag key="contour_ext" value="elevation_medium" zoom-appear="12" force-polygon-line="true" />
      <osm-tag key="contour_ext" value="elevation_major" zoom-appear="12" force-polygon-line="true" />
      <osm-tag key="ele" value="100" zoom-appear="14" />
      <osm-tag key="ele" value="200" zoom-appear="14" />
      <osm-tag key="ele" value="300" zoom-appear="14" />
      <osm-tag key="ele" value="400" zoom-appear="14" />
      <osm-tag key="ele" value="500" zoom-appear="14" />
      <osm-tag key="ele" value="600" zoom-appear="14" />
      <osm-tag key="ele" value="700" zoom-appear="14" />
      <osm-tag key="ele" value="800" zoom-appear="14" />
      <osm-tag key="ele" value="900" zoom-appear="14" />
      <osm-tag key="ele" value="1000" zoom-appear="14" />
      <osm-tag key="ele" value="1100" zoom-appear="14" />
      <osm-tag key="ele" value="1200" zoom-appear="14" />
      <osm-tag key="ele" value="1300" zoom-appear="14" />
      <osm-tag key="ele" value="1400" zoom-appear="14" />
      <osm-tag key="ele" value="1500" zoom-appear="14" />
      <osm-tag key="ele" value="1600" zoom-appear="14" />
      <osm-tag key="ele" value="1700" zoom-appear="14" />
      <osm-tag key="ele" value="1800" zoom-appear="14" />
      <osm-tag key="ele" value="1900" zoom-appear="14" />
      <osm-tag key="ele" value="2000" zoom-appear="14" />
      <osm-tag key="ele" value="2100" zoom-appear="14" />
      <osm-tag key="ele" value="2200" zoom-appear="14" />
      <osm-tag key="ele" value="2300" zoom-appear="14" />
      <osm-tag key="ele" value="2400" zoom-appear="14" />
      <osm-tag key="ele" value="2500" zoom-appear="14" />
      <osm-tag key="ele" value="2600" zoom-appear="14" />
      <osm-tag key="ele" value="2700" zoom-appear="14" />
      <osm-tag key="ele" value="2800" zoom-appear="14" />
      <osm-tag key="ele" value="2900" zoom-appear="14" />
      <osm-tag key="ele" value="3000" zoom-appear="14" />
      <osm-tag key="ele" value="3100" zoom-appear="14" />
      <osm-tag key="ele" value="3200" zoom-appear="14" />
      <osm-tag key="ele" value="3300" zoom-appear="14" />
      <osm-tag key="ele" value="3400" zoom-appear="14" />
      <osm-tag key="ele" value="3500" zoom-appear="14" />
      <osm-tag key="ele" value="3600" zoom-appear="14" />
      <osm-tag key="ele" value="3700" zoom-appear="14" />
      <osm-tag key="ele" value="3800" zoom-appear="14" />
      <osm-tag key="ele" value="3900" zoom-appear="14" />
      <osm-tag key="ele" value="4000" zoom-appear="14" />
      <osm-tag key="ele" value="4100" zoom-appear="14" />
      <osm-tag key="ele" value="4200" zoom-appear="14" />
      <osm-tag key="ele" value="4300" zoom-appear="14" />
      <osm-tag key="ele" value="4400" zoom-appear="14" />
      <osm-tag key="ele" value="4500" zoom-appear="14" />
      <osm-tag key="ele" value="4600" zoom-appear="14" />
      <osm-tag key="ele" value="4700" zoom-appear="14" />
      <osm-tag key="ele" value="4800" zoom-appear="14" />
      <osm-tag key="ele" value="4900" zoom-appear="14" />
      <osm-tag key="ele" value="5000" zoom-appear="14" />
       <!-- .... etc ....  -->

3. [you can skip this by downloading suitable theme]
use rendertheme of your choice and edit rule file ".xml". Add the following code just before waterways section. This edited file use as rendering theme for vector maps in your locus in order to display also terrain contour lines.

        <!-- contour lines level 12 -->
        <rule e="way" k="contour_ext" v="*" zoom-min="12" zoom-max="12">
           <rule e="way" k="contour_ext" v="elevation_minor">   
              <line stroke="#60800000" stroke-width="0.3"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.6"/>
        <!-- contour lines level 13 -->
        <rule e="way" k="contour_ext" v="*" zoom-min="13" zoom-max="13">
           <rule e="way" k="contour_ext" v="elevation_minor">   
              <line stroke="#60800000" stroke-width="0.2"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.5"/>
        <!-- contour lines level 14-->
        <rule e="way" k="contour_ext" v="*" zoom-min="14" zoom-max="14">
           <rule e="way" k="contour_ext" v="elevation_minor">   
              <line stroke="#60800000" stroke-width="0.15"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.4"/>
              <rule e="way" k="*" v="*">
                 <pathText k="ele" font-style="bold" font-size="10" fill="#000000" stroke="#ffffff" stroke-width="2.0" />
        <!-- contour lines level 15-->
        <rule e="way" k="contour_ext" v="*" zoom-min="15" zoom-max="15">
           <rule e="way" k="contour_ext" v="elevation_minor" zoom-max="15">   
              <line stroke="#60800000" stroke-width="0.12"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.3"/>
              <rule e="way" k="*" v="*">
                 <pathText k="ele" font-style="bold" font-size="10" fill="#000000" stroke="#ffffff" stroke-width="2.0" />
        <!-- contour lines level 16 -->
        <rule e="way" k="contour_ext" v="*" zoom-min="16" zoom-max="16">
           <rule e="way" k="contour_ext" v="elevation_minor">   
              <line stroke="#60800000" stroke-width="0.08"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.2"/>
              <rule e="way" k="*" v="*">
                 <pathText k="ele" font-style="bold" font-size="10" fill="#000000" stroke="#ffffff" stroke-width="2.0" />
        <!-- contour lines level 17 and above -->
        <rule e="way" k="contour_ext" v="*" zoom-min="17">
           <rule e="way" k="contour_ext" v="elevation_minor">   
              <line stroke="#60800000" stroke-width="0.06"/>
           <rule e="way" k="contour_ext" v="elevation_medium|elevation_major">   
              <line stroke="#60800000" stroke-width="0.15"/>
              <rule e="way" k="*" v="*">
                 <pathText k="ele" font-style="bold" font-size="10" fill="#000000" stroke="#ffffff" stroke-width="2.0" />

4. if you have prepared your environment correctly, run these commands, and you should end-up with map file created.

4.1 download and process the terrain data.

C:Python27Scriptsphyghtmap --polygon=E:OSMpolygonsslovakia.poly -o E:OSMsrtm-dataslovakia_srtm6 --source=view1,view3,srtm1,srtm3  -s 20 -c 200,100 --start-node-id=20000000000 --start-way-id=10000000000 --write-timestamp --max-nodes-per-tile=0

4.1.1 [highly recommended] after the pyghtmap has downloaded hgt elevation data, you can kill phyghtmap and use srtmfill utility to fix "null" data in hgt files (I had a lot of null/invalid data so i had to fix them all). before proceeding to next step you have to run phyghtmap command again so the osm file will be created from valid elevation data.

4.1.2 [better speed - not recommended] instead of --polygon option you can use -a in this step and cut the map polygon in next step with osmosis (processed in few seconds/minutes, but the result quality is worse).

4.1.3 [optional] you can cut-out the map area corresponding with polygon file used for processing the terrain data

osmosis --rx e:OSMosm-map-dataeurope.osm.bz2 --tee 1 --bp file="E:OSMpolygonsslovakia.poly" --wx e:OSMosm-map-dataslovakia.osm

4.2 [optional] sort is essential before merge (merge task is requiring all osm files sorted). proceed with this step for one or both files if you get errors during merge.

osmosis --rx e:OSMosm-map-dataslovakia.osm.bz2 --sort --wx e:OSMosm-map-dataslovakia.sorted.osm

4.3 merge both files together

osmosis --rx e:OSMosm-map-dataslovakia.sorted.osm --rx E:OSMsrtm-dataslovakia_srtm6.osm --merge --wx e:OSMosm-map-dataslovakia.merged.osm

4.4 create final map using mapsforge mapwriter plugin

osmosis --rx e:OSMosm-map-dataslovakia.merged.osm --mw file=e:OSMmapsforgeslovakia.ter.osm.map bbox=47.6,16.7,49.8,22.7 type=hd tag-conf-file=e:OSMtag-mapping.xml

- zoom level 12 and 13 doesn't generate well - probably a bug of mapsforge library (maps published after 8th of May are much better)
- elevation text is more likely displayed at zooms 16-17, but for zooms 14-15 is very rarely visible, although its defined

Maps for download:
(minor contour line steps are 20m, major line steps are 100m)

France 2012-05-29 (1095 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7SGh5OWNKaVJsLVE
Germany 2012-09-09 (728 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7X0Y3a0ItNjFjdHc

Europe (Custom regions):
Alps 2012-09-09 (631 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7bGtrNVctNHpSUjA
Austria+Switzerland 2012-09-09 (309 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7SHFpNFlNYjRkVW8
Baltic states (EE,LT,LV+Kaliningrad) 2012-09-09 (77 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhYjFsQXJPa1oxeU0
BeNeLux 2012-09-09 (369 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7d3liM2dGMDR0TjQ
former Yugoslavia (SI,HR,SRB,BiH,MN,MC) 2012-09-09 (192 MB) https://docs.google.com/open?id=0B3Ijv5irWwU7NndLamVnM1ExUVE
Greece, Albania, Cyprus 2012-09-09 (146 MB) https://docs.google.com/open?id=0B5YCQIJNF5XhUXd0aFBpd1BKN2M
Iberian peninsula (ES,PT,AD,GI) + isles 2012-09-09 (387 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7OUQ5ZHhwUmZkV3c
Italy + Malta 2012-09-09 (408 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7LU9KNmNQTk5hb0E
Romania+Bulgaria 2012-09-09 (225 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7T0h2Qkd2bmRVZDg
Scandinavia (DK,NO,FI,SE)  2012-09-09 (689 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7NjFFUG5nLUcwMHc
UK+Ireland+Iceland 2012-09-09 (360 MB): https://docs.google.com/open?id=0B3Ijv5irWwU7TDBsQzhKN1VnTjg
Visegrád Group (CZ,SK,PL,HU) 2012-09-09 (399 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhZjlKQUVvNHNncHc

Asia (Japan):
(Japan-parts.png https://docs.google.com/open?id=0B5YCQIJNF5XhY09oNnJiNmNsMWM)
Hokkaido 2012-05-19 (58 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhblduWDZ3M3pqTDQ
Ryukyu islands and Pacific islands 2012-05-14 (8 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhU2lqaWdVRDNvamc
Honshu 2012-05-?? (??? MB): cancelled...
Shikoku 2012-05-19 (37 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhbmE5MkRWWTFSeVE
Kyushu 2012-05-26 (72 MB): https://docs.google.com/open?id=0B5YCQIJNF5XhY2RhbmFyVVhmVkE

if you are missing something, try to make a wish <!-- s;-) -->;-)<!-- s;-) -->

europe regions maps available for download here are created according to these polygons: 

*** starting from 8th May, new tag-mapping.xml ruleset will be used to create maps***
so you can adjust your themes accordingly. hiking (v0.3) theme will be updated too.

<osm-tag key="highway" value="bus_stop" zoom-appear="15" />
<osm-tag key="amenity" value="cafe" zoom-appear="16" />
<osm-tag key="amenity" value="drinking_water" zoom-appear="15" />
<osm-tag key="amenity" value="fast_food" zoom-appear="16" />
<osm-tag key="amenity" value="parking" zoom-appear="16" />
<osm-tag key="amenity" value="pharmacy" zoom-appear="16" />
<osm-tag key="amenity" value="place_of_worship" zoom-appear="15" />
<osm-tag key="amenity" value="pub" zoom-appear="16" />
<osm-tag key="amenity" value="restaurant" zoom-appear="15" />
<osm-tag key="shop" value="supermarket" zoom-appear="15" />
<osm-tag key="railway" value="halt" zoom-appear="15" />
<osm-tag key="railway" value="tram_stop" zoom-appear="15" />
<osm-tag key="tourism" value="alpine_hut" zoom-appear="14" />
<osm-tag key="tourism" value="attraction" zoom-appear="16" />
<osm-tag key="tourism" value="hostel" zoom-appear="15" />
<osm-tag key="tourism" value="hotel" zoom-appear="15" />
<osm-tag key="tourism" value="information" zoom-appear="15" />
<osm-tag key="tourism" value="museum" zoom-appear="16" />
<osm-tag key="tourism" value="viewpoint" zoom-appear="15" />
<osm-tag key="historic" value="memorial" zoom-appear="16" />
<osm-tag key="historic" value="monument" zoom-appear="16" />

see also some screenshots in attachment.
any feedbacks welcome.

Resources used:
http://oruxmaps.foroactivo.net/t2216-co ... xmapsforge (thanks to kech61 for first kick)

### this post will be edited from time to time, so please check it sometimes for updates, improvements and fixes ###
last update: 2012-09-09 22:41


Very nice. Thank you for your work.
Regards J.


jurajs very very nice. May you inform me about results? Compare time to generate such map vs classic method. Same for result size ...

Also should I theoretically use your method for generating whole world for Locus with contour lines?
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


I'll be glad if you can use any of these resources and steps from my guide. actually, it wasn't all my own skills... I have stolen a lot of knowledge from internet ;-) but i guess i took the best from all the resources found out there. please let me know how can i forward some examples and all the commands acually used (if you are interested).

please have in mind that this is just first draft (the first worthy to publish), there are many many things to improve. e.g. the problem with "missing" contour lines around the map border. also the way how are the captions showing altitude on the lines is not clear enough to me. only on the zoom level 17+ is quite OK. i am sure that you guys can point-out many of that weaknesses and possibly also imporvments ;-)



I'm aware of it, don't worry. I don't want to just right now start generating new maps with contours :). "Problem" is that I spend too much time work on locus itself, so I'm not sure if I'll be able to help make this system better. We'll see. Anyway I think that if generating will work correctly in the end, it should be really a massive improvement for tourist usage of MapsForge maps not even in Locus. And because here is so many skilled people like you, I'm sure result will be impressive ;)
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


1st post is now updated with actual informations...

made some progress last days
-maps looks slightly better
-problem with bad/incomplete data near map borders is history

I'll be glad if someone could test it and write some comments/feedback
stay tuned and enjoy...


Some new maps added (see 1st post) including czech republic, chroatia, poland, hungary, etc... now it's processing a map of germany, austria, switzerland and serbia. I am planning to make and share most of the europe. If you have a hint or a special wish, just let me know.



perfekt, thank you very much. Can´t wait until Germany is ready.  :mrgreen:

Klick on the screen for better preview.
Regards J.



this topic is about what I was waiting for a long time: contour lines for vector maps. But why not use the new Locus feature which makes possible to overlay maps. I would find it much easier to generate contour lines as a separate layer because they don't need to be updated like the maps. So you could have the mapsforge maps as one layer and the contour lines as another. Unfortunately I don't know nothing about generating maps, but perhaps someone in this forum does and could provide those contour line maps?

Thanks Joachim


very interesting idea but have one big issue - MapsForge library cannot handle two map files at once. I also blocked this in Locus & Map overlay (but there is small problem that this protection do not work correctly), so what you say is not currently possible
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download


What a pity! So I hope someone (maybe you, Menion?) will provide and update the mapsforge maps including contour lines, because this is a very big step towards perfect nice topographic maps to be used for biking, hiking and so on.

Thanks all of you for your work. It's such a benefit for people like me who just want to use those maps.


hi joa

i don't see this as a big problem... i guess the menion will include this maps in his map generating schedule and the problem with updating is gone. of cousre the part of data containing the contour lines doesn't need to be updated as frequently as map layer. terrain can be done just once and when new map files are updated, only merge with terrain data is needed. the merging is not that time consuming. nobody can expect that it will be updated weeky as it is on mapsforge download site, but who knows... maybe it will become standard some time ;-)

the size of the maps is bigger cca from *1.2 to *3.0, depending on how hilly the area is. i guess this is not that big obstacle too, because the size is still pretty reasonable.

and the last thing... you can still see the original map without contour lines just by using original render theme. when you need to see also the terain, you can select "edited" theme that displays also elevation contour lines.

@menion: thanks to joa i got another idea regarding overlays ;-) I'd like to see a fancy relief shading as a overlay to vector maps with contour lines. what do you think about this idea, would that be possible ? and... is somewhere out there a possibility to download just that terrain shade tiles ? or some guide how to do that ? ;-) damn i'm horny about that ;-)

btw: NL, AT, BE will be out there soon ...


Thanks jurajs, this makes me hopeful. But I'm just facing another problem: I can't see the contour lines. I just downloaded two of your maps (Luxembourg and Bosnia-Hercegovina) to see how it looks like, but on my device (Sony Ericsson Xperia active, Android 2.3) no contour lines are displayed, it's just the normal mapsforge maps. In the maps settings I can still choose the "osmarender" theme, nothing else. What's wrong? I'm using Locus 2.3.0.

Thanks Joachim



open this link viewtopic.php?f=40&t=1853 and follow the instructions how to "install" the theme.



just one more remark: make sure that you have your locus updated.

edit: i'm blind.... 2.3.0 is ok ;-)