logo separator

[mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

From Gerd Petermann gpetermann_muenchen at hotmail.com on Fri May 7 06:39:08 BST 2021

Hi Felix,

just noticed that patch v3 still only looked for mkgmap:has-direction=1 in one place.

Anyway, I am very unsure how to handle the direction flag. It's probably not a good idea to transfer the flag too ALL lines which are created from one OSM way.

I also found some cases where roads are not merged because the angle is too sharp. This was discussed here:http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2013q3/018649.html
I think it was introduced to avoid bad routing at places like https://www.osm.org/node/606366325 where we don't want to merge the two link roads.
I think the angle should be ignored if only two roads with the same attributes meat. Like here: https://www.osm.org/node/1387136827

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von Felix Hartmann <extremecarver at gmail.com>
Gesendet: Donnerstag, 6. Mai 2021 17:55
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

ah okay, no worries I can patch it myself.

On Thu, 6 May 2021 at 23:46, Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>> wrote:
Hi Felix,

the patch possibly has an influence on routing, so I don't want to add it to the low-res-opt branch.
I can provide two binaries if needed.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>> im Auftrag von Felix Hartmann <extremecarver at gmail.com<mailto:extremecarver at gmail.com>>
Gesendet: Donnerstag, 6. Mai 2021 17:42
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

Could you directly push those patches to the low-res branch? I guess anyone using it right now would like to try it with the patch..
I will try it out tomorrow.

On Thu, 6 May 2021 at 18:32, Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>>> wrote:
Ahh, sorry, merge-roads-reversed-v2.patch was work-in-progress. v3 works as described before.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>>> im Auftrag von Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>>>
Gesendet: Donnerstag, 6. Mai 2021 12:30
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

Hi all,

here is the 2nd approach:

RoadMerger can connect more roads if direction of the roads doesn't matter reg. routing.  Problem is that mkgmap doesn't know if direction matters unless the oneway tag
says so. The patch
- implements new special tag mkgmap:has-direction=true which must be set for ways which shoud not be reversed.
I am not yet sure how to use this. My idea was that the style author knows which types are direction depended and this should add
mkgmap:has-direction=true for those lines which should not be reversed.
Before road merging all map lines which were created for a given OSM way are checked. If any has a direction then all lines for the given OSM way are marked to have a direction.
Maybe this needs more thinking.

- The program checks if there is any line rule that uses mkgmap:has-direction=true. If not, mkgmap will not reverse roads for better merging.
- implement new experimental option --x-force-reverse-merge to override the logic reg. mkgmap:has-direction=true.

Reg. size the patch is probably not worth the effort. It just merges a few more roads (I see maybe 3% more merges) and thus safes some KB in NET and NOD.
I see this also as a preparation to do more merging in the low-res-opt branch.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>>> im Auftrag von Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>>>
Gesendet: Mittwoch, 5. Mai 2021 16:53
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

Hi Felix,

the patch contained two bugs:
- Roads with different direction are not merged when they are connected at the beginning.
- angle calculation was wrong, maybe that rejected possible merges or did the worse ones.

When I talk about overlays I mean those lines which are created with the continue statement or with overlays rules.

Gerd

________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>>> im Auftrag von Felix Hartmann <extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>>>
Gesendet: Mittwoch, 5. Mai 2021 16:46
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

If the direction of a line is changed, will all lines created via continue also be changed? If yes then this decreases the lines a lot where I would need the special tag. If not it will get complicated...
Well and the patch itself so far only saved about 0.3% of total map size. Better than nothing for no visual impact of course.

On Wed, 5 May 2021 at 22:43, Gerd Petermann <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com><mailto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com>>>> wrote:
Hi Felix,

no idea why you talk about waterways here. The thread is about a patch for RoadMerger. As the name suggest this code merges roads, nothing else.
RoadMerger considers far more attributes of lines compared to the simple LineMerger, not just the type and name but also all the attributes which affect routing.
It will not merge oneways with opposite direction, nor does it merge roads which are used in restrictions.

My current approach is to implement the new special mkgmap:has-direction=true
If the style sets this for a road or any of its overlay lines RoadMerger should not reverse the road.

Gerd
________________________________________
Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk>>>> im Auftrag von Felix Hartmann <extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>>>>
Gesendet: Mittwoch, 5. Mai 2021 13:04
An: Development list for mkgmap
Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads with reversed points

Actually when I think about it - reversing the direction for waterways should be done anyhow - there is no waterway that flows in opposite direction. Cliff lines most likely the same.
And for lines that are off center - that doesn't matter as long as all resulting lines are reversed. It would actually be better as otherwise at one point the right side jumps to the left and this could be prevented.

Yes oneway roads (plus all copies created from it via continue) - those you cannot merge.

On Wed, 5 May 2021 at 18:47, Felix Hartmann <extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>>><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com>>>>> wrote:
will that patch also work on the low resolution branch, or only against trunk?

On Wed, 5 May 2021 at 18:05, Gerd Petermann <GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>>><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com><mailto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com>>>>> wrote:
Hi all,

up to now RoadMerger doesn't merge (combine) two roads if the have different directions. This is OK for oneway roads but I see no need for this with other roads. The attached patch changes this. It has an influence on file size (safes a few KB in each tile) and very likely also on routing, hopefully to the better/faster.
It also reduces zig-zagging in the low-res-opt branch.

Strangely enough almost all was already implemented, so maybe WanMil (the original author) tried that before and found a reason not to do it. Will search the archives later...

Gerd
_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>>><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto: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

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk>><mailto:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto: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

_______________________________________________
mkgmap-dev mailing list
mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk><mailto: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><mailto: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

_______________________________________________
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



More information about the mkgmap-dev mailing list