Hauke’s Projects

Playin' around with Electronics and Computers

Creating the “Perfect” Hiking Map for Germany and other Countries

In this post I show how to create useful hiking maps by merging OpenStreetMap data with the usually excellent official maps of the cartographic offices of Germany and several other countries. Using MOBAC and Maperitive, a transparent layer containing POIs, landscape features and elevation information is generated from OSM data and then overlayed on the official maps. Also, mapsources for OruxMaps are derived for the various countries.

This time not so much bla bla, but to skip directly to the tutorial, click here.

Updates

June 25th 2017: Added Luxembourg
June 26th 2017: Added Switzerland
July 1st 2017: Added Denmark and the Netherlands
July 2nd 2017: Added OruxMaps mapsources
July 9th 2017: Made the previously experimental rendering the default one. And: Text rendering bug in Maperitive seems to be gone. Removed that bit.
April 2nd 2019: Added Grison (Graubünden)
May 12th 2019: IGN France now requires proper referer
October 5th 2019: Updated rendering rules (some improvements that accumulated over time, especially hiking scales); and NGI Belgium no longer requires registration
November 12th 2019: Updated Switzerland map sources
April 2nd 2021: Improved rendering rules
April 3rd 2021: WebAtlasDE and SwissTopo no longer need registration → Changed text, mapsources and OruxMaps files; Netherlands no longer offer EPSG:3857 (or compatible) for top10nlv2 layer → Needed to remove that
July 28th 2023: Changed to basemap.de – WebAtlasDE is deprecated and offline, Basemap DE its successor (n.b.: I am not fully done with that, the Orux maps map source file needs an update,  my improved rendering rules are missing, and the text needs a bit of an overhaul. Still, the basics are now here.)

Map Data Copyrights

The maps and map data shown in the images in this post are based on OpenStreetMap (© OpenStreetMap contributors) and the Basemap DE (© 2023 basemap.de / BKG, Datenquellen: © GeoBasis-DE) by the Geodatenzentrum bes Bundesamtes für Kartographie and Geodäsie in accordance with the usage rights as given at the time of this writing.

The Goal

While my Media Center blog post makes it clear that watching TV is not among my favorite pastimes, hiking certainly is. To properly plan a tour and to navigate the terrain effortlessly, two things are required: A GPS device, and good maps. While the former nowadays is any smartphone, the latter is not as easy to come by. “But what about OpenStreetMap?” you may ask. While this is certainly a very good source (of which I make heavy use in this project, and to which I contribute regularly), the general quality depends on the frequency of OpenStreetMappers to be found in a given region. Here’s an example:

Comparison between OpenStreetMap (Map data © OpenStreetMap contributors) and Basmep DE (© 2023 basemap.de / BKG, Datenquellen: © GeoBasis-DE)

On the left is the standard OpenStreetMap (OSM) rendering, on the right the Basemap DE map of the Dienstleistungszentrum des Bundes für Geoinformation und Geodäsie, part of the Bundesamt für Kartographie und Geodäsie – that is the Federal Agency for Cartography and Geodesy. Although the region above in the Eifel is close to densly populated areas and the Eifel is a very popular hiking area, this actual part of the Eifel is surrounded by areas that hold a few more attractions for hikers, so most hikers go there and not here. As a result, many ways are missing in OSM, since noone mapped them.

The Basemap DE is based on the “official” surveys done by the federal government office, so the general quality of the data is excellent. And the high resolution maps are free to use for private purposes! The access to the maps is possible using a web map service (WMS) or a web map tile service (WMTS) respectively, which is supported by many applications. Really cool! There’s also a vector map, but I’ll not look into this here – future project.

On the other hand, Basemap DE is inferior to OSM in many other regards – again, here’s an example of a far more popular hiking region, around the Drachenfels in the Siebengebirge near Bonn:

Comparioson of OpenTopoMap (Map data © OpenStreetMap contributors) and Basemap DE (© 2023 basemap.de / BKG, Datenquellen: © GeoBasis-DE)

This time I picked the OpenTopoMap rendering of OSM vs. Basemap DE. The OSM rendering offers

  • Points of Interest (POI) like ruins and viewpoints (at least more than Basemap DE)
  • Contour lines
  • Hillshading (now also available from Basemap DE)
  • Vegetation features
  • Landuse (e.g. the vineyards to the lower left or the cemetery to the lower right)
  • Landscape features like cliffs

It’s much more feature rich, and many features are really nice-to-have when hiking.

Wouldn’t it be nice to have the best of both maps in just one map? That’s my goal, and I show you how to get there in this post. As a teaser, here’s the same region from above as it looks in my rendering (I actually realize that I picked not the best region – it is that popular that it’s already getting kind of crowded with features):

My personal rendering, the Superatlas (© OpenStreetMap contributors & © 2023 basemap.de / BKG, Datenquellen: © GeoBasis-DE)

You can see that I’ve a different set of features in my rendering as compared to OpenTopoMap, and that’s the nice thing about the approach – I’ve full control on what I want to have in the map and what not. When you follow this post, you will learn how to adjust this as you like it. You may find the rendering a little bit thick/large on your PC monitor, but when you have it on a small smartphone screen, it’s just right for my taste.

Last remark before we start: Some work presented here was done shortly before a holiday trip and somewhat hasty. You’ll certainly find that the Maperitive configuration file is rather sloppily done and not well structured. Sorry for that – feel free to do it more cleanly! I never could bring myself to make it nicer…

Overview

Here’s the general approach:

  • Use Mobile Atlas Creator (MOBAC) to access the WMS of Basemap DE and
  • create a task in MOBAC that controls
  • Maperitive, which downloads and renders OSM data and
  • SRTM elevation data into
  • a transparant layer containing POI and other features,
  • hillshading and contour lines and
  • the OSM ways in low-key rendering.
  • Use MOBAC again to overlay the transparant Maperitve layer over
  • the Basemap DE tiles
  • and store it into an OruxMaps SQLite database atlas, the
  • SUPERATLAS! 🙂

Of course you can replace OruxMaps by your favorite hiking app as long as it is supported by MOBAC.

Important: All map services I mention in this post are provided for free. Abuse of these services may result in blocking actions by the service providers (there are some cases already!). Sometimes MOBAC is blocked (identified by the user agent string). Abuse may also at some point cause the service providers to raise fees. So please use the services in a responsible way, and always adhere to the terms of use each map service states.

Step by Step

MOBAC

The Mobile Atlas Creator is a very cool Java application that allows you to download map tiles from various WMS and WMTS into file based databases. These can then be used by GPS navigation apps on smartphones as offline maps. It supports a tremendously large number of apps – just click on the MOBAC link to check if your favourite app is listed. If you do not have a favourite yet, use the list to try them out and pick one. I personally fell in love with OruxMaps for Android.

If you pick an app, just be aware of one thing: The GPS apps store their offline map data basically in two possible ways: In a folder conatining the several hundred or thousand map tiles, each as a image file, or in a monolithic database, e.g. SQLite or as ZIP archive. I strongly recommend to pick an app following the monolithic approach, since transferring thousands of small files takes very long on most smartphones and uses the SD card quite inefficiently, while a single file database is much, much faster in transfer. The performance impact of getting the correct image from the single file is neglegible on modern phones.

MOBAC has two features that make it perfect for my purposes: It allows you to configure your own, custom map sources, and in that even to overlay several map sources. And it has a tool interface that can be used to control external tools, like in my case, Maperitive.

So here’s a huge thank you to Robert “r_x” for MOBAC – and he does not even accept donations for his work…

In the sense of my how to: Your task is to download MOBAC and unpack it somewhere for later use.

Maperitive

Maperitive is another of the quite unbelivably powerful free tools you find on the net, done by a single author, Igor Brejc. Many thanks to you! Maperitve allows you to download OSM data and render them using a rule set you can define and configure yourself. This rule set is what I use to define which OSM features I want to see in my map and which icons, colors and fonts to use.

Maperitive also has algorithms in it to convert elevation data into contour lines (again configurable via the rule set) and hillshading.

It finally allows you to export the rendered map in various ways, among them a tile set similar to what a WMTS offers, which then can be consumed by MOBAC. And Maperitive may be controled via command line and script files, which allows me to “remote control” it through MOBAC.

Again: Task is to download and unpack it. Like MOBAC, it does not come with an installer, but is a stand alone application (like portable apps) you can start from anywhere where you unpacked the archive.

SRTM Elevation Data

Maperitive needs elevation data for the hillshading and contours, and I think the most popular is the Shuttle Radar Topography Mission (SRTM) data. This exists in a lot of versions from many sources which I found rather confusing. As per documentation Maperitive should download SRTM data automatically, but I never had any success here. This is how it worked for me:

  • Create a directory Cache\Rasters\SRTMV3R3 in the Maperitive base directory (if it is not there already).
  • Go to viewfinderpanoramas.org’s map selector and click on the region or regions you need coverage of.
  • Save the ZIP file(s) somewhere and unpack the .hgt files in the ZIP into the directory created in the first step.

As stated on the homepage of viewfinder panoramas, the service is free for private use. Many thanks to Jonathan de Ferranti! By the way: I think it’s not pure SRTM data, but filled in with complementary data from other missions – the details are on the viewfinder panoramas page.

Optional: Create a Map Source for Basemap DE in MOBAC

If you want to view Basemap DE without the overlay, you need to create a map source for this. In the MOBAC directory you find a folder named mapsources. In there, create the following file BasemapDE.xml:

Create Rendering Rules for Maperative

In the Maperative directory there’s a folder Rules. In there are the rule sets which describe the way the OSM data is rendered. There is an introduction to rulesets on the Maperitive documentation page, which is very good and will guide you how to make your own rendering rules. I add some explanations on how I created and fine tuned my rules at the end of the post. Here I’ll just describe what you get when you download and use my Superatlas.mrules. As already said above, this is not the most beautiful piece of configuration file – it was created while learning Maperitive alongside and not having too much time at my hands. Its badly structured, cluttered and, last but not least, uses German words – but it works :-). In the following table I include the German words that I used in the file to allow you to understand and modify the rules. This table is also the legend for my Superatlas, and tells you which OSM data I render into my maps. I wanted symbols that are similar to the German style topographic maps, so I also created a number of icons, which you can download here in a ZIP file. I use them alongside with those already provided with Maperitive. Feel free to use my icons as you like. Just extract the files into the folder icons\SJJB\png within the Maperative directory. In retrospective I should have created my own directory – feel free to do so, but be aware that you need to modify the rules file then.

Superatlas Legend

Symbol Meaning German
(if relevant for the rendering rules)

Castle/Palace

Castle (ruins)/Palace (ruins)

Burg/Schloss

Burgruine/Schlossruine

Church/Monastery

Church (ruins)/Monastery (ruins)

Kirche/Kloster

Kirchenruine/Klosterruine

Chapel/Chapel (ruins) Kapelle/Kapellenruine
Shrine/Place of worship: Christian Schrein/Christlicher Ort
Cross/Waycross Kreuz/Wegkreuz
Mosque/Mosque (ruins) Moschee/Moscheeruine
Synagogue/Synagogue (ruins) Synagoge/Synagogenruine
Place of worship: islamic/jewish Muslimischer/Jüdischer Ort
Place of worship/Temple Heiligtum/Tempel
Ruins Ruine
Gallows, Pillory Galgen, Pranger

Memorial/Monument

Stolperstein (a special kind of memorial for holocaust victims)

Denkmal/Monument

Stolperstein

Boundary stone/Milestone Grenzstein/Meilenstein

Tombstone/Rune stone

Historic stone

Grabstein/Runenstein

Historischer Stein

Survey point Trigonometrischer Punkt
Fort/Battlefield Fort/Schlachtfeld
City gate Stadttor
Historic aqueduct Aquädukt (historisch)
Archaeological site Archäologischer Ort
Art Kunst
Viewpoint Aussichtspunkt
Guidepost Wegweiser
Parking lot Parkplatz

Restaurant/Café

Pub

Restaurant/Café

Kneipe, Biergarten

WC WC

Tower/Observation tower

Communications tower

Turm/Aussichtsturm

Funkturm

Lighthouse/Beacon Leuchtturm/Leuchtfeuer
Windmill/Watermill Windmühle/Wassermühle
  Observatory/Telescope Sternwarte/Teleskop
Cave/Adit, mine Höhle/Mine
Rock/Stone Fels/Stein
Broadleaved tree/Conifer/Tree Laubbaum/Nadelbaum/Baum

Information board/Tourist information

Hiking map

Infotafel/Touristeninforamtion

Wanderkarte

Bench/Picnic area

Fireplace

Sitzbank/Rastplatz

Feuerstelle

Shelter/Wilderness hut

Alpine hut/Ranger station

Schutzhütte/Wanderhütte

Berghütte/Rangerstation

Bird/Wild hide Vogel-/Wildbeobachtung
  Spring/Waterfall Quelle/Wasserfall
  Well/Fountain Brunnen/Springbrunnen
Geyser Geysir
Tap, Drinking water, Waterpoint Wasserhahn, Trinkwasser, Wasserpunkt
Swimming Badestelle
Climbing Kletterstelle
Deciduous forest Laubwald
Coniferous forest Nadelwald
Mixed forest Mischwald
Forest Wald
Scrubland Buschwerk
Moor Moor
Heath Heide
Vineyard Wein
Bare rock Felsgebiet
Scree Geröll
Glacier Gletscher
Precipice Felshang
Ridge Grat
Embankment, Outcrop (Steil-)Hang, Aufschluss
Rampart, Dike Wall, Deich
Gully Erosionsrinne
Quarry Tagebau
Cemetery Friedhof
 Attraction Sehenswürdigkeit
National park Nationalpark
Nature reserve Naturschutzgebiet
Highway/Path (except for motorways and trunks, which are not rendered at all)
Highway/Path – abandoned and/or badly visible
Stairs/Boardwalk Treppe/Bohlenweg
Ford Furt
Access private/No access (The access=no tag is often used for ways that are closed for vehicles, but are perfectly fine for pedestrians – hence the less alarming rendering)
Climbing aids (rungs, ladders, cables, …) Kletterhilfen
One-way trail (preferred hiking direction for e.g. climbing routes)

Hiking difficulty scales. These follow the Swiss Alpine Club (SAC) difficulty scale and are rendered in the recommended colors, i.e. T1, T2, T3, T4, T5 and T6.
Also rendered is the via ferrata scale if available – rendering looks like V1+.
If both are available, both are given and the color follows the SAC scheme.
Peak, contours

Last thing you need (or need to change in the rules): I use the font GaramondNo8 for any text. It is free to use under the Aladdin Free Public License. Only exception are the hiking difficulties, which are rendered using Arial Narrow, which comes with windows.

While creating this blog post (really happy I did, since it made me revisit this topic), I thought of rendering the OSM ways in an unintrusive way, so that I still have the Basemap DE ways as dominant layer, but can see where OSM might know more than the official maps. I usually also have full OSM map renderings with me, so I can then switch to them and check what kind of way there is. So, any kind of highway, except for motorways and trunks, which are not allowed to be used by pedestrians, are rendered as thin lines. Highways are purple dash-dot-dot lines, and pathes (OSM: highway=path) are lilac dotted lines. If there’s a chance that the ways are badly visible or difficult to pass, they are coloured orange. Stairs and boardwalks are highlighted, since they are often indicating interesting hiking places.

Integrating Maperitive as External Tool in MOBAC

Next step is to trigger the overlay map tile generation in Maperitive for the map you want to store as offline map database from MOBAC. I include Maperitive as an external tool in MOBAC. This involves

  • A DOS batch file that creates
  • a Maperitive script file that includes all instructions to generate the map tiles
  • and then starts Maperitive using exactly this script.
  • In MOBAC, the batch file is incorporated via an XML file.

The XML File

In the MOBAC directory there’s a folder tools – if not, create it. Into that, create a file maperitive.xml:

Replace [PATH TO] by the path to the batch file that we create in the next step.

The Batch File

Create a file maperitive.bat in the directory specified in the last step:

Replace [PATH TO MAPERITIVE] by the Maperitive directory (3×), and [PATH TO MOBAC] by the MOBAC directory (1×).

The batch file is started within MOBAC, and MOBAC will pass the arguments specified in the XML from the previous step. The batch file will create a new file named autogen.mscript, which is a Maperitive automation script. In there, the bounding box selected in MOBAC is included, along with the minimum and maximum zoom level selected. The script will then instruct Maperitive to create tiles within the bounding box, and for all selected zoom levels. An example of such an autogen.mscript may look like this:

In detail, the script tells Maperitive to…

  • Start from a clear map,
  • use the Superatlas rendering rules you downloaded or created before,
  • expand the rendering buffer to avoid cut-off text on tile borders,
  • set the map area to the bounding box selected in MOBAC,
  • download the OSM data from the Overpass API,
  • load the SRTM elevation data,
  • generate contours and hillshading and
  • finally create all the map tiles into the directory Tiles (which you may need to create beforehand).

The last thing the batch file does is to start Maperitive and tell it to execute the autogen.mscript.

Be aware that Maperative will need considerable time to create the tiles!

Some remarks:

  • generate-contours interval=10 means that contours are generated for each 10 meters of elevation, but Maperitive will adaptively draw contours only as specified in the rendering rules. The rules may use any multiple of 10.
  • generate-relief-igor intensity=1.25: There are several algorithms for hillshading in Maperitive, but I found igor to be the best. Intensity 1.25 is the result of some trying around – I’d like to have it a little bit more pronounced for shallow hills, but if I increase the intensity, real mountains (like the Alps) come out too dark. So 1.25 is the compromise.

Create a Multilayer Map Source in MOBAC

Now having the rendered tiles, the next step is to combine them. MOBAC needs an XML file again in the mapsources directory to define the layers and the transparency of each layer. So create Superatlas.xml:

This is a multilayer map, first containing Basemap DE, and as second layer the tiles from Maperitive from a local directory. Adjust [PATH TO MAPERITIVE] to match your environment. The second layer is set to only 80% opacity (<layersAlpha>), which I find better since the Basemap DE shines through the OSM layer a bit, but adjust this to your liking.

In case you created the optional mapsource for Basemap DE earlier, make sure its map name is the same as the layer name in the mapsource here. Both will use the same cache in MOBAC, which speeds up things considerably.

Workflow

Now that everything is properly set up, you can start creating offline maps. In order to create the Superatlas offline map for your smartphone, the following steps need to be taken:

  1. In MOBAC, mark the region you want to have in the database.
  2. Select the zoom levels you want to have in the database.
  3. Click on “External tools” and select “maperitive”.

    Steps 1-3 in MOBAC (Map in image © 2023 basemap.de / BKG, Datenquellen: © GeoBasis-DE)
  4. A window will ask you to confirm the start of Maperitive and the parameters that will be handed over. Make sure that minimum and maximum zoom level are as expected.

    MOBAC workflow #2
    Check zoom levels
  5. Maperative will now start up and automatically walk through the necessary steps to generate the Superatlas tiles. Maperative will close itself as soon as the tiles are done. Depending on zoom levels and mapped area this may take minutes to hours.
  6. Close and reopen MOBAC. MOBAC may otherwise not realize that new tiles are there. MOBAC usually keeps all settings, including the selected map region etc.
  7. Select “Superatlas” as map source and continue to create your offline map as usual. If you’ve never done this, have a look at the quick start manual of MOBAC.

In case you already have the Superatlas tiles for the required region, the above steps are not necessary any more; you may directly create the offline files.

Of course any features you use in MOBAC, e.g. multiple map layers etc., work as usual. From the MOBAC point of view the Superatlas is nothing special.

Potential Issues

When Maperative starts up, watch the command window. You’ll see when the OSM download starts. If the selected map region is too large, the Overpass server may reject the query. Maperative will still create tiles, but only with the elevation information. If you realize this too late, hours of waiting may have been in vain.

Maperitive OSM Download
How OSM download should look like if everything is fine

Limitations

One of the obvious limitations is map size. At some point, OSM download will fail, tile generation will take forever, MOBAC atlas creation will take ages and file sizes will be huge. So be reasonable when creating your offline maps – whole of Germany will certainly bust all limits.

Another limitation is rendering quality in regions where OSM mappers got into very much detail – here’s an example:

Things can get crowded

Unfortunately Maperitive has no collision algorithm yet. A feature request exists, but as of now you may end up in situations like here.

Not as annoying but still not perfect is the vegetation and landuse rendering – since the ways of the Basemap DE are unknown to Maperitive/OSM, they cannot be taken into account when placing the patterns. So, trees will stand on streets, but who cares…

Vegetation rendering on streets

Another thing: While Basemap DE does not have many POIs, it has some. Once in a while you’ll find doubled symbols, one from the Basemap DE layer, and one from OSM:

Double symbols

Not much to be done about it. I cannot switch off the church symbol as the example above would suggest, because Basemap DE does not tag every church. So I’d miss some. Luckily, the symbol placement often is so close you hardly notice it (like in the image above).

Potential Improvements

Currently the OSM data download in Maperitive is rather inefficient, since there is no selection of what is actually downloaded. Espacially with large regions you may hit a wall because of too large queries. It should not be too difficult to make the query more selective. That might also speed up tile creation.

Another thing: It is possible to download a copy of the OSM data locally as a large, compressed file, e.g. from Geofabrik. Maperitive can make use of these data extracts. I never tried it, but this may speed up tile creation and may allow for rather large maps. Would be worth a try.

Edit May 2019: Now can use Geofabrik files – see my post “Hiking Maps Follow-Up: Large Area Maps”.

Other countries

The European Union is following an open data strategy in many places, and the Geo-portals like Basemap DE are implementations of this. Many EU countries offer free access to their map data in a similar way, typically asking you to register, but being free of charge for private use. The map quality is usually excellent, although the features provided vary between the countries, e.g. with regard of POIs, hillshading, contours etc. This may require to adjust the Maperative script and/or rules, but I hope the information above is enough to achieve this.

I’ll list all countries below where I successfully created Superatlas-implementations. This is certainly not exhaustive and may grow over time. If a country is missing, look for it yourself, it is not that difficult to figure out the mapsource-files, and sometimes they are even provided by the map vendor! If you created an implementation, I’d be happy to get a mail from you to learn about it. If it’s OK for you, I’ll then publish your solution here.

Important: All services I mention below were free of charge and allowed the usage described here at the time I wrote the regarding section. However, terms of use may change over time. Make sure that the intended purpose is still legal and allowed before following my examples – it is your responsibility to understand the terms of use and adhere to them!

Maperative from MOBAC with no Elevation Information

Since many countries already have contour lines and/or hillshading in their maps, it is a good idea to create a Maperative external tool command to create tiles without elevation information. Approach is the same as above, just three lines stripped from the batch:

Replace [PATH TO] by the path to the batch file.

Replace [PATH TO MAPERITIVE] by the Maperitive directory (3×), and [PATH TO MOBAC] by the MOBAC directory (1×).

Austria

For Austria there exist several map sources. basemap.at is free even without registration, and provides MOBAC mapsources on it’s homepage! Cool!

“Basemap Grau” has hillshading and contour lines, so for Superatlas create the Maperitive tiles without elevation information. “Basemap Grau” also has a low key color scheme which I like, so that’s what I use for my Austria Superatlas (make sure you installed the mapsources from basemap.at beforehand):

As many times before, replace [PATH TO MAPERITIVE] to match your installation.

There’s also austrianmap.at from the Bundesamt für Eich- und Vermessungswesen, which provides very good maps (actually again scanned topographic maps), but as of now I’ve not found a legal way to use them.

Belgium

The Nationaal Geografisch Instituut (NGI) offers very good topographic maps (look computer rendered to me). Usage for private (non-commercial) purposes is free as far as I understand the terms of use. Registration is no longer required (Thanks to Mick for sending me a note on this!).

Here’s the mapsource:

For Superatlas the mapsource is rather simple, just pick up the name of the mapsource above – a scheme that will repeat itself for most mapsources to follow:

Replace [PATH TO MAPERITIVE] to match your installation.

The maps from NGI already contain contour lines and at some zoom levels hillshading, so use the “no elevation” Maperitive. NGI maps also contain some POIs and some lanscape features which somtimes interact not too well with the Superatlas layer. It may make sense to create different rendering rules for Belgium.

Denmark

Googeling brought me to geus.dk first, but their terms of use, while granting free access, strongly discourage the use of tiled download from their WMS. Asking them, Bjarni from IT very friendly pointed me at kortforsyningen.dk, which offers a large amount of data for download (even Minecraft data!) – thanks for this hint! Most is available via WMS, but some also via WMTS. You need to register, all in Danish, but Google-translatable 🙂 – after registration you’ll need to set a password, and with these credentials access to the data is free and download is allowed.

With regard to topographic maps, you need to choose between vector and raster maps, the latter being feature rich and include contour lines, the former computer rendered, more simplistic/abstract and having no elevation information. The vector maps are very good for the Superatlas overlay, while the raster offer loads of additional information. Difficult choice – so I decided to create two map sources:

  • A Bean shell script mapsource that has the 1:1,000,000, 1:500,000, 1:200,000, 1:100,000, 1:50,000 and 1:25,000 raster maps as zoom layers 8, 11, 12, 13, 14 and 15, and filling all other zoom levels from 7 to 20 with the vector maps, and
  • A simpler XML mapsource just having the vector map for all zoom levels.

Bean shell allows you to create rather complex map sources that require coordinate transformations, some web request modifications and much more, but I am no expert here. The examples from the MOBAC wiki are a good starting point if you’d like to learn more.

Let’s start with the simple XML source:

Please watch for line 11 – you’ll need to fill in your credetials for [USERNAME] and [PASSWORD].

The Bean shell mapsource is based on the second example on this MOBAC wiki page. The layer logic is slightly more complicated due to the mixing of the various maps – make sure to replace [USERNAME] and [PASSWORD] with your credentials in all lines (7×):

The Superatlas mapsource follows the Germany-scheme, since the vector maps are a WMS XML map source:

Replace [PATH TO MAPERITIVE], [USERNAME] and [PASSWORD] to match your data.

France

The Institut national de l’information géographique et forestière (IGN) offers excellent official maps via its Geoportail. You’ll need to register to legally access and use the excellent IGN maps. Honestly, I do not exactly remember how I did the registration a few years ago, but I think it was here. During registration, you’ll be asked for a referer, which should look somwhat like “http://your.webpage.tld” – we’ll need this in a second. After registration, you will also get an access code that we’ll need for the Bean shell mapsource IGNgeoportail.bsh:

Replace [INSERT YOUR ACCESS ID HERE] by your access code from above, and replace [INSERT YOUR REFERER HERE] by the referer you sepcified during registration.

The very observant person may notice that I ask for FORMAT=image/jpeg, but in the end use extension .png – that’s OK. I tried it differently, but did not work…

The XML for the Superatlas follows the simple name reference scheme:

Replace [PATH TO MAPERITIVE] to match your installation.

Since the IGN maps already have contour lines and hillshading, I’d recommend to use non-elevation Superatlas tiles. Additionally the icon sizes in the Superatlas rendering are too small for the IGN map resolution, so I’d also recommend to create dedicated rendering rules. However, the IGN maps are already so good (it’s actually scanned topographic maps) that the Superatlas OSM-layer is not really needed – I never bothered to adjust my own rendering.

Luxembourg

The official map service can be found at the Geoportail Luxembourg, which is available in four languages. And they offer a tremendous amount of different layers and information, among them very good topographic maps. The terms of use allow to use this maps for free; however, to use the API for MOBAC you need to register. There is no webform, just write an email to support.geoportail@act.etat.lu and state your request (English worked fine for me). I asked them for a specific URL as referer in my mail and they registered this URL for access. So, the mapsource looks like this – it adds the referer as a header variable for authentication:

Replace [REFERING URL] with the URL they registered for you.

Tiny addendum: Since MOBAC beanshell does not support the serverParts load balancing as in XML map sources, I programmed a simplistic load balancing using modulo 2 of the x tile number as server part.

You may also try to replace topogr_global with basemap_2015_global – it’s another rendering of the topographic maps, which you may or may not like more than the other. Both contain some elevation information (contours and/or hillshading), so use the “no eleveation” Maperitive tiles.

For Superatlas again the simple name scheme:

Replace [PATH TO MAPERITIVE] to match your installation.

The Netherlands

The Netherlands offer their maps under CC-BY-SA 3.0 licensing if it is listed “open”. Their service itself is offered under fair-use policy without any registration. Similar to Denmark, they offer raster and vector based maps, so like Denmark I put two mapsources here. The vector-only mapsource uses the BRT achtergrondkaart. The achtergrondkaart is well suited for the Superatlas layer.

The pure vector-based mapsource (no needs for adjustments this time):

And the raster maps (nothing to edit here also), based on the Wiki-example:

And finally the Superatlas (no surprises here):

Replace [PATH TO MAPERITIVE] to match your installation.

Switzerland

Swisstopo offers topographic maps of very good quality; you may not need to add the Superatlas layer. Since 2021 these maps are free to use – they have not been before, which is why I used bean shell mapsources. I guess it would be possible to convert this into simpler XML mapsources, but I did not bother, so the mapsource is again the Bean shell example from the MOBAC wiki modified for our needs:

You may want to look at the capabilities of the WMS – they offer quite a bit of layers there, among those ch.swisstopo.swisstlm3d-karte-farbe, which is an automatically rendered high resolution topographic map. The capabilites can be found here.

One interesting feature is to overlay the map with the official hiking trails, rendered in yellow, red and blue according to the SAC hiking scale. It’s as simple as altering the layers in the URL in the bean shell mapsource to LAYERS=ch.swisstopo.pixelkarte-farbe,ch.swisstopo.swisstlm3d-wanderwege.

If you want to use the Superatlas layer (which might still be useful since the POIs in the Swiss rendering are very low key), here the standard scheme – use the layer without elevation data.

Pascal pointed out in the comments that there is a WMTS for Swisstopo, and I finally got around to accessing it. For the sake of completeness, here’s the mapsource (which yields exactly the same tiles as the WMS):

Grison (Graubünden)

One of my blog readers asked me for assistance with including the Canton Grison WMS in Switzerland into MOBAC. Here’s the mapsource for the “Basiskarte farbig” (other layers are available), which is free to use. It seems that there is also a payed service with more maps available, but the “Basiskarte” leaves little to wish for. Only caveat: useful results are only available for zoom levels 16-17 (18 works, but is just double size pixels). Here’s the mapsource:

You may ask: How would I approach such a WMS service, where do I start? A good starting point always is the “GetCapabilities” function of a WMS, which tells a lot about what the service has to offer. Try it out (You’ll get an XML file):

http://wms.geo.gr.ch/basisplan?service=wms&version=1.1.1&request=GetCapabilities

In the XML you’ll easily find the layers and projections. If among the available projections you find EPSG:4326, you can use the simple XML mapsource like the one above for Grison (see also in the MOBAC reference). It is an alias for the WGS 84 projection mainly used in context with GPS. If you can’t find that projection, try with bean shell examples from this post. Honestly, I struggled a lot learning this, so I guess looking back there are a number of bean shell sources above that might be converted into XML mapsources, but I’m just too lazy 🙂 However, if it comes to complicated use cases where you need to send HTTP headers like Authentication information, you must go for the bean shell version, which is very powerful in that regard.

Countries that will not work

UK

Ordnance survey allows to register for free for their API that provides their famous maps, but terms of use explicitly deny storing maps on any device except for 24 hours max. of caching 🙁

To be continued…

I’ll add countries here whenever I’ve figured out a new one.

OruxMaps Mapsources

As I mentioned above, I really like and can recommend OruxMaps as GPS hiking app for Android! I recently learned that I can add custom mapsources also to OruxMaps to use as online maps and even to create offline maps out of OruxMaps directly. The format is so close to MOBAC mapsources, it’s practically a no-brainer to translate them. basemap.at even provides the code for the Austrian maps on their webpage. Here you’ll find the mapsources for all countries I figured out for MOBAC as far as they work with OruxMaps. N.b.: It’s only the “native” maps, no Superatlas.

Important: It is your responsibility to understand the terms of use of each service in the mapsources and adhere to them! Abuse will most likely at some point cause the services to close down for OruxMaps or to charge fees.

 

The files below go into the oruxmaps/mapfiles directory on your phone, and it seems it must be the internal storage (maybe wrong, I’ve seen phones behave differently with regard to storage locations). web_services.xml replaces the one that’s already there, and onlinemapsources.xml goes into the customonlinemaps subdirectory (do not replace the one in the mapfiles directory itself!).

Do not just copy the files from here – you’ll need to edit them and add the access codes, referers, keys etc. as described above for the MOBAC mapsources – the regarding lines are highlighted below. Which means that for several of the services you need to register. The regarding tokens are exactly the same as for MOBAC. You may also decide to strip the mapsources that require registration/authentication – should be easy to figure out.

I’ll keep these two files updated in case I create new MOBAC sources that can also be used in OruxMaps.

Remark: Currently Denmark as given in the web_services.xml below does not work – will update at some point.

Switzerland no longer needs manual integration, since it is now part of the stock online map sources in OruxMaps, but I included a version with the hiking trails overlayed.

I did not try to mimick the mapsources for MOBAC that accumulate different layers for different zoom levels, like Denmark or the Netherlands. For these countries I only included the basemaps. If you want the layers I did not include, it should not be too difficult to figure it out from the sources I provide above.

Appendix: Some Hints on Editing the Ruleset

What to Show

When I decided what to show on my map and what not, I used the list of map features from OSM and went through it. A lot of work, but you need to do this only once. With Basemap DE, some features are already in the map, so no need to render them again in the OSM layer. Once in a while I come to the conclusion that I miss a feature in my maps, then the feature list is the way to find out what to map.

Fine Tuning

When I made the ruleset, I often found examples where the rendering did not meet my expectations. In such cases, I analyzed how the specific location was mapped in OSM in order to optimize the features section in the rules, i.e. how a location is classified for later rendering. Here’s an example from the teaser map above – the ruins on the Hirschberg:

Ruins on Hirschberg
The ruins on the Hirschberg

They are shown with the generic ruins icon. But I suspect them to be castle ruins, since a closeby place is named Hirschburg, and “Burg” means castle. What I do in such a case is to run Maperitive and navigate to the location:

Locate in Maperitive
Locate region in Maperitive

Now I download the OSM data for the region:

Download OSM
Download OSM data for the region

Make sure that you really only select the part of the map that contains the object in question and not much more, because we need to locate the data in the downloaded file in a minute – so: the shorter the OSM data file, the better. In the commander-window you’ll see the URL and query that was submitted to the Overpass API:

OSM Download URL
The OSM data download URL in the commander window

I now take the whole URL/query – in the example:

– and paste it into my web browser. It will download the OSM data, which I then open in a text editor. In the example it’s rather short:

You can see that the location is tagged historic=ruins. And there’s a link to an image. After a little research you find out that it was an observation tower once, not a castle. So, in this case no need to adjust the rules, since the generic ruins icon is correct. But using this method I fine-tuned the rendering rules.

As an example what the result is, here my selection rules for the target “baum” (= tree):

You may wonder why it’s so complicated. The reason is that some very active OSM mapper mapped really each and every single tree in Troisdorf and the surrounding villages (actually you can meet the guy on the Bonner OSM Stammtisch). In the beginning, my target just looked like this:

So “baum” was everything that was not explicitly a needleleaved or broadleaved tree, i.e. the unspecific, generic tree. But Troisdorf was just a mess! Trees all over the map, you could not see anything else! What I wanted in my map were trees that were remarkable, outstanding trees. And such trees are usually tagged with denotation=natural_monument or tourism=attraction, or they have a name (hence @isMatch(name, “.*”)) – which I found out examining some special trees well known to me with the method above.

So I thought: Now I’m happy, but yet again: I had an outstanding tree in my map, but when I went there: No tree! What was wrong? Using the method above again I realized that the tree had an end date in OSM – in other words: At some point it died and was removed. So now I only render trees that have no enddate (NOT @isMatch(end_date, “.*”)).

Final Remarks

Thanks to the authors of Greenshot which I used to take the screenshots shown here!

I make use in this post of data from OpenStreetMap. The data is made available under ODbL. Thanks to all contributors (which includes me :-))!

27 thoughts on “Creating the “Perfect” Hiking Map for Germany and other Countries

  1. Hi,

    Thanks for your great article

    WMTS Swiss Topo maps exist in pseudo mercator projection (EPSG:3857)

    see http://api3.geo.admin.ch/services/sdiservices.html#other-projections

    Regards,

    Pascal

    1. Hi Pascal,

      thanks for this hint! I’ll check this and perhaps simplify the mapsources for SwissTopo. Should also make OruxMaps-Integration easier.

      Kind regards

      Hauke

  2. Hi Hauke, interesting work, thank you!

    The Ordnance survey maps for the UK are available as a layer on Bing Maps, including 1:50000 and 1:25000 scale. For example: https://www.bing.com/maps?osid=8aa2e618-de5d-4435-85b3-dedfaccb02b7&cp=53.069145~-4.074451&lvl=15&style=s&v=2&sV=2&form=S00027

    To download bing tiles, a Bing Maps key can be obtained, it’s free for personal use:- https://msdn.microsoft.com/en-us/library/ff428642.aspx

    1. Hi Richard,

      thanks for the hint! With regard to UK I also had contact with the OS IT department, and they explained that for private use without public webpage the API key approach is fine. I registered for the API key and will in the next weeks try to access the OS pages. The computer rendered layers are also quite good and interesting for the Superatlas. Will update my post when I figured everything out!

      – Hauke

  3. Just wanted to thank you profusely for this veritable life saver! I am a scientist, I live in Zurich and I also am a passionate mountain biker. SwissTopo is by far the most precise, accurate, and detailed topo map of the Swiss Mountain. Finally, I can use it with OruxMaps, which is the best MTB orienteering app! This is what I had been wanting to do since years. Heartfelt thanks, Adriano

  4. The link for Luxembourg geoportail doesn’t work.
    In oruxmaps I changed for

    <url><![CDATA[https://wmts1.geoportail.lu/opendata/wmts/topo/GLOBAL_WEBMERCATOR_4_V3/{$z}/{$x}/{$y}.png]]></url>
    1. Hi Ben,

      thanks for pointing this out! It seems that they changed their loadbalancing servers. Alternatively to your modification you might also change this:

      <servers>wmts1</servers>

      and add other servers in case some work. At the time I wrote the post it was wmts3 and wmts4, so I’d not be surprised if currently wmts1 and wmts2 would work.

      A pity they do not keep it stable…

      Hauke

  5. Hi Hauke, I’ve been playing a bit with the Swiss .bsh an found that while it works (you get an usable map) the result is fuzzy if compared with the Swisstopo website. It turns out it actually is fuzzy because of interpolation of tiles, looks like they are shifting one zoom level and being enlarged. I changed tileSize from 256 to 128 and it fixes the display in MOBAC, but then you aren’t able to export to files (either it fails or it gives a wrong map). It’s not that I know what I’m doing, it was just a random attempt looking at the file… Any idea about how to make this work?

    Thanks

    1. Hi Maki,
      the fuzzyness is indeed interpolation, and if I follow your example and choose 128 pixels as tile size, I get the same tile at half size. To my surprise, this still results in a viewable map, but everything else is off, which is why you do not get a proper map. I played around a bit with the bsh (which as I mentioned is not written by myself, but a modified example from the MOBAC wiki), but I could not bring it to work with smaller tiles properly. Which does not surprise me the least, since the tiles need to be as big as they are to match the projection at a given zoom level. If the Swiss chose not to give them at better resolution, nothing to be done about it.
      However, I took your comment as an opportunity to look for the WMTS which Pascal Bouton mentions in his comment above. It requires seperate registration, which I just initiated, but have not yet received an OK for. As soon as I have it I’ll let you know if I get sharper images there and will publish a mapsource for that.
      Finally, you may want to check the layer ch.swisstopo.swisstlm3d-karte-farbe, which is vector based and is not fuzzy – it looks quite different, but is still very detailed and good!
      Cheers,
      Hauke

      1. Hi Maki & Pascal,
        I now successfully accessed SwissTopo maps via WMTS, works well. @Maki: The tiles I get are exactly the same as those via WMS, so no improvment (honestly I did not expect anything else). In general however I find the maps brilliant, so the slight fuzziness is not bothering me.
        Finally, I think that the maps on the website look sharper because they are pixel-matching screen resloution, but actually the precision/resolution is the same. So with MOBAC you don’t lose information. It is however and admittedly wasting storage space since you download redundant information.
        – Hauke

  6. Hi Hauke,

    Other sources of maps for MOBAC are available and often updated on this site (in french) : http://randochartreuse.free.fr/mobac2.x/mapsources/

    For example, for France, access to the IGN has been switched to HTTPS since January 2020 (http://randochartreuse.free.fr/mobac2.x/index.htm#IGN2020)

    For maps not available in the WGS84 (EPSG 4326) or Pseudo Mercator (EPSG 3857) projection, it is possible to use Mapproxy (https://mapproxy.org/) to reproject them on the fly in WGS84 or Pseudo Mercator projection.

    Regards,

    Pascal

     

  7. Hallo Hauke, interesting information you’re providing. Thank you. I tried to build my “own” maps using your explanation. But stumbled. It seems that the German Bundesamt for Geodäsie has changed their homepage. So I’m lost- stopped ;-(

    Do I still have to register?

    If yes, where and what for?
    If not, what is the correct call/link to get the wms data (currently in your example..

    http://sg.geodatenzentrum.de/wms_webatlasde__[INSERT YOUR ID HERE]?</url>

    Sorry for asking, Im still better in following tracks on Oruxmaps and Garmin than understanding the way of creating maps…still learning

    thank you for your help

    p.s. per 01.03.2020 the Swiss have also changed their access to toposwiss, you might have a look at that…

    1. Hi Werner,
      OK, I need to look a bit deeper here. I once in a while get mails from those institutions, but I tend not to read them too closely, so perhaps I missed something. Will give an update as soon as I found time, worst case only on the weekend.
      Stay safe!
      Hauke

      1. I looked a bit into this. It seems that indeed the access no longer requires registration. So, these are the available services: https://gdz.bkg.bund.de/index.php/default/solr/search/index/?q=webatlasde – however, WMTS seems to use a non-standard tile numbering scheme (I’ll see if I can work out a conversion, but it may be that the grid does not match standard convention, then WMTS will not be usable with MOBAC), and the WMS seems to require version 1.3.0, while MOBAC in the past only did 1.1.1. I’ll have a look at the newer MOBAC version, with a bit of luck it will now do 1.3.0 also. Will keep you posted!

    2. Ah, I have it! Due to whatever reason https:// was not working, and to debug I changed to http://, and while I expected a failure, actually it worked! So this mapsource works without authentication:

      <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
      <customWmsMapSource>
         <name>WebAtlasDE free</name>
         <minZoom>1</minZoom>
         <maxZoom>17</maxZoom>
         <tileType>PNG</tileType>
         <version>1.1.1</version>
         <layers>webatlasde.light</layers>
         <url>http://sgx.geodatenzentrum.de/wms_webatlasde.light?</url>
         <coordinatesystem>EPSG:4326</coordinatesystem>
         <aditionalparameters>&amp;STYLES=</aditionalparameters>
         <backgroundColor>#000000</backgroundColor>
      </customWmsMapSource>
      

      Please make sure to adhere to their terms of use!

      Will update my post in the next days.

  8. accessing the German wms servers works!

    one small detail, when unpacking MOBAC 2.1.4 the folder “tools” does not get generated. You have to create it yourself …. so maybe change your description

    The XML File
    In the MOBAC directory there’s create a folder tools. Into that, create a file maperitive.xml:

    I put the maperitive.xml in the ..\maperitive\tools\ with the effect that MOBAC disabled the tools button;-(

    and a question you might be able to help:

    I try to print a map including my own track with MOBAC–> Paper Atlas(pdf) . Your design and R.Klink (ultraleicht-trekking) description results in a perfect paper map, BUT without printing the track. Do you have an idea how to achieve it? Any hints? tips?

    Inkatlas.com produces these maps, but with restrictions e.g. tile boarders….

    1. Hi Werner,
      thanks for pointing me to the tools-folder inaccuracy, will correct this when I find time to update my post.
      On the printing topic: No idea I’m afraid. I never used the print function. However, I’d encourage you to contact the MOBAC author – I found him rather approachable in the past.
      – Hauke

  9. done. 13.03.2021 the answer from r_x on the MOBAC forum:

    “Tracks in MOBAC are never printed onto any map no matter which output format you chose. They are just a tool for determine the region to download.”

  10. Hi Hauke,
    very nice page and cool rule of a hiking map. I liked Superatlas.
    I am using maperitive for city maps. Some of the icons (mosques forexample) are not shown in the default rendering rule of maperitive.

    I tried to edit the default rendering rule to add mosques but couldn’t do. Is there a simple way?
    thanks
    Ekrem

    1. Thanks for the praise, and thanks for making me aware. Mosques *should* be rendered, I added this to the rules, but I never checked. Now I did, with the central mosque in Cologne, and it is actually rendered. Did you check if the mosque is actually in the OSM data?
      Here’s how it looks in my rendering:
      Central Mosque Cologne
      That said: Including any kind of rendering into the rules is not too complicated. In a nutshell:

      • Create the Icon, save as PNG and put it to the other icons
      • In the mrules file in the matching part of features section add a line like this:
        mosque : building=mosque
        “building=mosque” is referring to OSM attributes/tags – it can do if/and/or/… – look at other definitions for inspiration.
      • in the rules add a section for your object that defines the rendering and refer to your icon. I recommend again to look at existing definitions and try to learn from them. Or use the maperative documentation.
      1. Dear Hauke,

        MY

        icon-image : icons/SJJB/png/place_of_worship_islamic.p.32.png … was wrong

        I fixed to

        icon-image : icons/SJJB/png/place_of_worship_islamic3.p.32.png

        now it is correct and works fine–> shows up the Points of mosques.

        but still cannot see the Building Polygons of mosques..

        1. Glad you worked that out!

          Regarding building outlines: In the rulesets there are different sections, some that refer to points/nodes, some that refer to areas, and some for lines. You may need to specify rendering rules for the different types – for building polygons it would be “area”/”areas”.

  11. Dear Hauke,
    Thanks for the fast reply. I am sure that your .mrules file do work fine and has the Mosques rendered.

    but Maperitive’s default.mrules file doesnt have the line about mosques. Here is my solution after I edited the “default.mrules” but I couldn’t make it work. The lines begining with “mosques” are added by me:

    hospital : amenity=hospital
    recycling : amenity=recycling
    church : amenity=place_of_worship AND religion=christian
    mosque : amenity=place_of_worship AND religion=muslim
    drinking water : amenity=drinking_water
    bank : amenity=bank
    atm : amenity=atm
    toilets : amenity=toilets
    library : amenity=library
    tree : natural=tree

    …………….

    draw : icon
    target: church
    define
    icon-image : icons/SJJB/png/place_of_worship_christian3.p.32.png
    min-zoom : 16
    icon-width : 16
    define
    draw : icon
    target: mosque
    define
    icon-image : icons/SJJB/png/place_of_worship_islamic.p.32.png
    min-zoom : 16
    icon-width : 16
    define
    …………..

    1. Ah, stupid me, did not understand that you were referring to a different ruleset.
      As a suggestion: Formulate the mosque-line this way:
      mosque : (amenity=place_of_worship AND religion=muslim) OR building=mosque
      May be that you get more mosques this way.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top