Mapsforge maps: how to highlight hiking routes, bike paths?

Started by darauble, May 01, 2021, 08:26:23

0 Members and 1 Guest are viewing this topic.

darauble

Hello,

First of all, I am gladly buying all the LoMaps updates without a hesitation to add my small contribution to support my mapping software of choice. But I am also contributing to OSM actively and try to keep my maps updated.

I have found my way of generating vector maps and even POIs (overwriting the .db file from LoPoints).

However, the original LoMaps have hiking routes and bike paths highlighted (hiking in orange, bike paths in purple etc.). If I generate my own map from PBF, it looks absolutely the same in general except those routes/paths are not displayed or displayed just partially (something different probably in original OSM).

One workaround is to display LoMaps with generated maps overlay, but it is clumsy and also renders edited streets or other objects incorrectly, there are also some other rendering issues, like double patternns or cut off letters etc. Also, it seems it drains battery quicker. Another workaround is to extract routes and import them as GPX, but that's not sustainable and works well only on limited area and requires extra work and is not suitable when one finds himself in an unknown area without preparation. Of course, it is always possible to switch between the maps, but that's again additional inconvenience.

Is there a way I could achieve the same display with Osmosis+Mapsforge? Maybe I need to extract relations+ways+nodes and merge them into final map somehow? I use the theme XML from Asamm Software in Github, but this does not help with the routes/paths.

Cheers and thank you in advance.
  •  

voldapet

Hi,
thank you for the message and for OSM mapping.

Honestly, we use quite an old script for the creation LoMaps hiking/cycling routes and maybe there is a better way how to do it.
As I can remember the mapsforge writer supports relations only partially when "line" relations aren't supported. For this reason, isn't possible to simply add hiking routes into a tag-mapping.xml file. There are our steps:
- We parse the source data and search for hiking/cycling relations
- From these relations are created a new OSM ways with the same tags as parent relation. To be correct the osmc:symbol is divided into several parts: osmc_color | osmc_background | osmc_foreground (that you can see in the tag-mapping xml file
- the new ways are merged (using osmosis) into the original OSM data file and used for map generation

Honestly, I follow the mapsforge news only partially in the last year and maybe there is another solution.
I can also suggest checking the online LoMaps (available in LM4) because online LoMaps are updated about every 7 - 14 days.
  •  

darauble

Thank you. I already found, that adding route=hiking and network=<something> to the way highlights the route in Locus Map. So I am already crafting a script to extract the routes and merging them back into final vector map.

And thank you for pointing out online version, I'll definitely check it out!
  •  

voldapet

  •  

darauble

My own crafting went quite well, but I didn't find solution to mark ways, that are part of more than one network, e.g. international hiking route and local cycling path. Maybe you could share your knowledge on how this is accomplished with LoMaps? I've got somewhat obsessed at this stage :-D
  •  

voldapet

We create a new way for every relation. So if there are more relations more ways are created. So we copy the geometry (nodes) from the original way, set new ID and set the new attributes (from relation). So it may happen that the hiking and cycling ways are overlapped. And it's the theme that has to "handle" it.
  •  

darauble

I see. I have tried to copy ways and it worked, but not fully, however I left the same nodes. I'll try to copy the nodes too then. Thank you for replies and openness :-)
  •  

voldapet

It's not needed to copy the nodes, only create a new way with the same nodes, new ID and new attributes
  •  

darauble

Tried both, however I am still missing something. E.g. international hiking and national cycling routes on original LoMaps are displayed as separate lines on different sides of road (red and blue). On my version with newly created ways the colored lines are merged. Where routes separate, lines also separate.
  •  

voldapet

Honestly, I don't know. I can only say:
- every way in relation is duplicated and attributes from relation are set to this new way
- the orientation of the way is the same as the original one (the orientation has an impact on the offset of the line in styles)
- osmc:symbol is divided into three parts and set as standalone attributes

Please send me the link on the  relations, specific way and screenshot from Locus
Thanks, Petr
  •  

darauble

The example way of question: https://www.openstreetmap.org/way/123736376#map=15/54.1418/24.1821

A part of two relations:
https://www.openstreetmap.org/relation/12456647#map=13/54.1110/24.1671
https://www.openstreetmap.org/relation/9652454#map=12/54.0841/24.1003

Attaching also the screenshots of original LoMaps and my own generated. Ways are copied with new IDs, references are left to existing nodes, attributes from relations also copied over.
  •  

voldapet

It seems to be correct. How old is your LoMap? In the latest LoMap is also the cycling color overlapped by red color because hiking IWN route. It also seems that the osmc:symbol isn't divided into mentioned 3 parts.
  •  

darauble

My LoMap is of version 2021.01.18 – the latest for Lithuania from the Store. I double checked, the generated map in the screenshot has osmc:symbol cut into parts as per your first comment.

Well... it is what it is :-) Probably there is some subtle difference.
  •  

gauvins

Quote from: darauble on May 01, 2021, 08:26:23
I have found my way of generating vector maps and even POIs (overwriting the .db file from LoPoints).

Could you expand on this? I would like to add POIs (rest areas).
  •  

darauble

  •