logo separator

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

From Felix Hartmann extremecarver at gmail.com on Fri May 7 14:39:52 BST 2021

I think merging would be fine. Garmin hates sharp angles anyhow and will
likely not chose them for a car route. And if cycling or walking it doesn't
matter too much if really an announcement is not given. Anyhow on sharp
turns there is usually a turn announcement also on the same road - most
switchbacks on trails are announced. Would be great if the penalty this way
could be lowered a bit..

On Fri, 7 May 2021 at 16:35, Mike Baggaley <mike at tvage.co.uk> wrote:

> Hi Gerd,
>
> I believe this activity is a precursor to reducing zig zags at low
> resolutions (though I may be confusing two different activities). I think
> the case shown here would be better handled by seeing whether at the low
> resolution the two entry points to the A13 can be reduced to a single
> point.
> For each side of the junction we would have two coincident one-way roads
> that could be reduced to a single two way road. Merging the two one-way
> roads into one would prevent this from taking place. I was under the
> impression that mkgmap split ways at junctions anyway, so I'm not sure what
> would be gained by joining these together. I do not have a full
> understanding of the code, so may have misunderstood this bit.
>
> Cheers,
> Mike
>
> -----Original Message-----
> From: Gerd Petermann [mailto:gpetermann_muenchen at hotmail.com]
> Sent: 07 May 2021 08:55
> To: Development list for mkgmap <mkgmap-dev at lists.mkgmap.org.uk>
> Subject: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads
> with reversed points
>
> Hi all,
>
> See e.g. the link roads which meat at
> https://www.openstreetmap.org/node/606366325
> I really wonder how mkgmap should treat roads like that which build a sharp
> angle. Current code doesn't merge them. I don't know how it worked in 2014
> but today I see no good reason for that. Routing results seem to be the
> same
> and mainly depend on the "avoid u-turn" setting.
> Maybe there is a difference when the --ignore-sharp-angles is used, but
> than
> that's probably exactly what the user wants?
>
> I've also seen several places where the two link roads are mapped with a
> single OSM way.
>
> The correct mapping probably requires two OSM ways and a turn restriction,
> but the Garmin routing algo really doesn't like sharp angles anyway and
> prefers large detours to avoid them when "avoid u-turn" is enabled.
>
> I've attached a new patch which ignores sharp angles where only two roads
> meet. This gives a few more merges.
> If you change the line
> private static final double MAX_MERGE_ANGLE = 130.0;
> to
> private static final double MAX_MERGE_ANGLE = 180.0;
> mkgmap will still prefer to merge the roads with the smallest angle but
> will
> also merge those with a sharp angle and thus reduce the NOD/NET size even
> more.
>
> I think mkgmap should use always merge if --ignore-sharp-angles  is used,
> but that's not implemented yet.
>
> Gerd
>
> ________________________________________
> Von: mkgmap-dev <mkgmap-dev-bounces at lists.mkgmap.org.uk> im Auftrag von
> Gerd
> Petermann <gpetermann_muenchen at hotmail.com>
> Gesendet: Freitag, 7. Mai 2021 07:39
> An: Development list for mkgmap
> Betreff: Re: [mkgmap-dev] patch: improve RoadMerger: allow to merge roads
> with reversed points
>
> 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.mkgm
> ap.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
> ><mai
> lto: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.mkgm
> ap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:
> mkgmap-dev-b
> ounces at lists.mkgmap.org.uk>>> im Auftrag von Gerd Petermann
> <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com
> ><mai
> lto: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.mkgm
> ap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:
> mkgmap-dev-b
> ounces at lists.mkgmap.org.uk>>> im Auftrag von Gerd Petermann
> <gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com
> ><mai
> lto: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.mkgm
> ap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:
> mkgmap-dev-b
> ounces at lists.mkgmap.org.uk>>> im Auftrag von Felix Hartmann
> <extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:
> extremecarve
> r 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
> ><mai
> lto:gpetermann_muenchen at hotmail.com<mailto:gpetermann_muenchen at hotmail.com
> >>
> <mailto:gpetermann_muenchen at hotmail.com<mailto:
> gpetermann_muenchen at hotmail.c
> om><mailto:gpetermann_muenchen at hotmail.com<mailto:
> gpetermann_muenchen at hotmai
> l.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.mkgm
> ap.org.uk><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk<mailto:
> mkgmap-dev-b
> ounces at lists.mkgmap.org.uk>><mailto:mkgmap-dev-bounces at lists.mkgmap.org.uk
> <m
> ailto:mkgmap-dev-bounces at lists.mkgmap.org.uk><mailto:
> mkgmap-dev-bounces at list
> s.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:
> extremecarve
> r at gmail.com<mailto:extremecarver at gmail.com>><mailto:
> extremecarver at gmail.com<
> mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:
> extrem
> ecarver 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:
> extremecarve
> r at gmail.com<mailto:extremecarver at gmail.com>><mailto:
> extremecarver at gmail.com<
> mailto:extremecarver at gmail.com><mailto:extremecarver at gmail.com<mailto:
> extrem
> ecarver at gmail.com>>><mailto:extremecarver at gmail.com<mailto:
> extremecarver at gma
> il.com><mailto:extremecarver at gmail.com<mailto:extremecarver at gmail.com
> >><mail
> to:extremecarver at gmail.com<mailto:extremecarver at gmail.com><mailto:
> extremecar
> ver 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
> ><mai
> lto:GPetermann_muenchen at hotmail.com<mailto:GPetermann_muenchen at hotmail.com
> >>
> <mailto:GPetermann_muenchen at hotmail.com<mailto:
> GPetermann_muenchen at hotmail.c
> om><mailto:GPetermann_muenchen at hotmail.com<mailto:
> GPetermann_muenchen at hotmai
> l.com>>><mailto:GPetermann_muenchen at hotmail.com<mailto:
> GPetermann_muenchen at h
> otmail.com><mailto:GPetermann_muenchen at hotmail.com<mailto:
> GPetermann_muenche
> n at hotmail.com>><mailto:GPetermann_muenchen at hotmail.com<mailto:
> GPetermann_mue
> nchen 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
> >><mail
> to:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk
> ><mai
> lto: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
> >><mail
> to:mkgmap-dev at lists.mkgmap.org.uk<mailto:mkgmap-dev at lists.mkgmap.org.uk
> ><mai
> lto: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
>
> _______________________________________________
> mkgmap-dev mailing list
> 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
> https://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>


-- 
Felix Hartman - Openmtbmap.org & VeloMap.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20210507/fabb9047/attachment-0001.html>


More information about the mkgmap-dev mailing list