logo separator

[mkgmap-dev] Commit r4715: rework of options for reverse merge

From Gerd Petermann gpetermann_muenchen at hotmail.com on Sat May 15 07:40:05 BST 2021

Hi all,

It's quite difficult to understand what the direction AND oneway attributes mean. I try to explain what happens:

For each line (and road) produced in the style mkgmap first checks if oneway=* or mkgmap:has-direction=* or the list from  --line-types-with-direction says that the line has  a direction -> dir-flag = true
Next it checks if mkgmap:has-direction=no says that this direction should be ignored -> dir-flag=false
This is done for a data structure ConvertedWay that still contains all the OSM tags.

Next RoadMerger merges roads. It will not reverse roads with oneway flag true or direction flag true and it will not merge roads which have different oneway or direction flags. If it does that would clearly be an error.

Next the data structures for IMG are created. Each line and road is converted to a MapLine or MapRoad object. Both have a dir-flag, MapRoad also has a pointer to further data for NOD which also contains the oneway flag. The dir-flag is set if the ConvertedWay says it is a oneway or has direction (or both). I am not sure if this is good, maybe for MapLine only the direction flag should be evaluated.
Next the creation of sub divs per level start.
For each sub div LineMerger takes all lines which are rendered at this level and tries to merge. If the level is for the overview map it will also merge roads. Unlike RoadMerger, The LineMerger looks only at type, name, and dir-flag and position of end nodes. Unlike RoadMerger It doesn't care if the original OSM ways are really connected.
In the low-res-opt branch LineMerger will also "reverse-merge " two lines if reverse is allowed by option --allow-reverse-merge and dir-flag is false for both.

For the overview map the LineMerger is executed again when the data from the different ovm_*.img files are combined.  At this stage lines with extened type don't (yet) have a direction flag because mkgmap doesn't write this information (yet). Normal types have a dir-flag and they are all treated the same, the NOD data with the oneway flag is ignored.
Also important now: LineMerger "sees" only the rounded coordinates, so it can merge even more lines (line dual carriage ways).

tl;dr:
If you want that mkgmap reverse-merges lines make  sure that they don't have a oneway tag and set mkgmap:has-direction=no.
We can discuss if the oneway tag should have an influence on the direction flag in IMG. I have not tried what happens when this is changed, it's a very old behaviour.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Felix Hartmann <extremecarver at gmail.com>
Gesendet: Samstag, 15. Mai 2021 05:04
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] Commit r4715: rework of options for reverse merge

Or could I also get the disabled 4710 behaviour by simply adding a catchall as first line.
e.g.
highway=* | railway=* | oneway=* | waterway=* . {set  mkgmap:has-direction=no }
and then only those lines defined before to not be reversed will not be reversed, but all lines that are connected because of continue with a line type listed in the --line-types-with-direction=XX will be reversed?

On Sat, 15 May 2021 at 10:50, Felix Hartmann <extremecarver at gmail.com<mailto:extremecarver at gmail.com>> wrote:
mkgmap:has-direction=no

Does this overwrite the line types listed for not reversing when it comes to - don't merge lines with different has-direction flag (as r4710 in the low-res-opt branch)?

E.g. in my style I first work off all the line types that are listed in --line-types-with-direction=XX
Then I put a line
highway=*, railway=*, ... {set  mkgmap:has-direction=no }

Or will this only affect lines where previously i have added  mkgmap:has-direction=yes? In that way it would be indifferent from writing  {delete  mkgmap:has-direction } or am I missing something?

On Fri, 14 May 2021 at 23:37, Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>> wrote:
Hi all,

I have also updated the low-res-opt branch with r4716. Let me here what you think about the new options and the results.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von svn commit <svn at mkgmap.org.uk<mailto:svn at mkgmap.org.uk>>
Gesendet: Freitag, 14. Mai 2021 17:16
An: mkgmap-svn at lists.mkgmap.org.uk<mailto:mkgmap-svn at lists.mkgmap.org.uk>; mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
Betreff: [mkgmap-dev] Commit r4715: rework of options for reverse merge

Version mkgmap-r4715 was committed by gerd on Fri, 14 May 2021

rework of options for reverse merge
- replace option --x-force-reverse-merge by --allow-reverse-merge which has to be set to enable reversing for merge, add documentation
- implement new option --line-types-with-direction to list line types which should not be reversed, also documented
- special tag mkgmap:has-direction=yes/1/true can be used to to mark a line as not reversable
- special tag mkgmap:has-direction=no/0/false can be used to to mark a line as reversable (does not overwrite oneway=yes or oneway=-1 tag, only the --line-types-with-direction option)
- remove code to detect if style sets mkgmap:has-direction=true
- remove code to propagte the mkgmap:has-direction=true tag to underlying roads, might not be needed
this reverts r4713 and r4714 and partly r4703
- don't merge lines with different has-direction flag (as r4710 in the low-res-opt branch)


http://www.mkgmap.org.uk/websvn/revision.php?repname=mkgmap&rev=4715
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>
https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev


--
Felix Hartman - Openmtbmap.org & VeloMap.org



--
Felix Hartman - Openmtbmap.org & VeloMap.org



More information about the mkgmap-dev mailing list