[Patch v3] drive-on-left/drive-on-right handling

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
Hi all,

attached is v3 of the patch. I think we should finish this before
we start with the coding for the non-rectangular tiles support.

1) I've tried to make sure that the flags in TRE and NOD are set to equal values.

2) The options --drive-on-left and --drive-on-right are deprecated but still
evaluated, for now a warning is printed when they are used.
The new option --drive-on=detect|right|left should be used instead.
The value detect enables a rather complex (but not CPU-intensive) algo:
1) For each roundabout it checks if the country is known and -- if so -- if the country
is a drive-on-left country.
2) If the number of "dol" roundabouts is larger than the rest, the internal drive-on switch is
set to "left", similar the internal drive-on switch is set to "right" if the number of "dor" roundabouts is
larger than the rest.
This works only if either a complete bounds file is used or the default country is set with
--country-abbr or --country-name.
3) If option --check-roundabouts is used and the internal drive-on switch is still "detect",
than the first found roundabout is used to set the internal drive--on switch.
4) Finally, If the internal drive-on switch is "left", the flags in the headers  are set to 1.
5) The polish fomat reader now recognizes the line
LeftSideTraffic=Y
in the mp file.
6) If the user specifies --drive-on=left, both header flags are set to 1, no matter what
roundabouts are found.

@Steve, WanMil:
I've added a ThreadLocal<boolean> to TREHeader similar to that in NODHeader,
but I think it would be better to store that info only once for each thread,
I just don't know where, maybe MapMaker?
Besides that I am not sure how this works when we write two different TREHeader files
in one thread (one for the overview map data ovm_*.img)
(well, the flag in these files is ignored anyway)
Please suggest a better solution.

Gerd



_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

driving-side-v3.patch (46K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

popej
Hi Gerd,

I publish some maps of Africa, like East Africa or South Africa. These
are parts of the world, where people drive on left. My default is
drive-on-left, but maps include some small parts with drive on right too.

I'm afraid drive-on=detect could fail for my maps, for example if a tile
contains no roundabouts.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
Hi Andrzej,

do you think that we should count all routable ways ?

Gerd

popej wrote
Hi Gerd,

I publish some maps of Africa, like East Africa or South Africa. These
are parts of the world, where people drive on left. My default is
drive-on-left, but maps include some small parts with drive on right too.

I'm afraid drive-on=detect could fail for my maps, for example if a tile
contains no roundabouts.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Colin Smale

I can't see how that would work, unless you can deduce that two parallel one-ways are part of the same dual carriageway. And that's an algorithm that many people would like to have, I'm sure...

Colin

 

 

On 2014-12-02 13:45, GerdP wrote:

Hi Andrzej,

do you think that we should count all routable ways ?

Gerd


popej wrote
Hi Gerd, I publish some maps of Africa, like East Africa or South Africa. These are parts of the world, where people drive on left. My default is drive-on-left, but maps include some small parts with drive on right too. I'm afraid drive-on=detect could fail for my maps, for example if a tile contains no roundabouts. -- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev



--
View this message in context: http://gis.19327.n5.nabble.com/Patch-v3-drive-on-left-drive-on-right-handling-tp5826060p5826069.html
Sent from the Mkgmap Development mailing list archive at Nabble.com.
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
Hi Colin,

I did not think that far. My idea is to detect the country of each routable way,
I don't care about unclear cases. If that result says that there are more
ways in the dol area, we set the drive-on-left flag. We may also cumulate the
lengths of the ways. I don't care if any specific way is a "dol" or "dor" one.
That might be interesting when we are able to create non-rectangular tiles.

Gerd

Colin Smale wrote
I can't see how that would work, unless you can deduce that two parallel
one-ways are part of the same dual carriageway. And that's an algorithm
that many people would like to have, I'm sure...

Colin

On 2014-12-02 13:45, GerdP wrote:

> Hi Andrzej,
>
> do you think that we should count all routable ways ?
>
> Gerd
>
> popej wrote
>
>> Hi Gerd, I publish some maps of Africa, like East Africa or South Africa. These are parts of the world, where people drive on left. My default is drive-on-left, but maps include some small parts with drive on right too. I'm afraid drive-on=detect could fail for my maps, for example if a tile contains no roundabouts. -- Best regards, Andrzej _______________________________________________ mkgmap-dev mailing list
>
>> mkgmap-dev@.org
>
>> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev [1]
>
> --
> View this message in context: http://gis.19327.n5.nabble.com/Patch-v3-drive-on-left-drive-on-right-handling-tp5826060p5826069.html [2]
> Sent from the Mkgmap Development mailing list archive at Nabble.com.
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev [1]
 

Links:
------
[1] http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
[2]
http://gis.19327.n5.nabble.com/Patch-v3-drive-on-left-drive-on-right-handling-tp5826060p5826069.html
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Steve Ratcliffe
In reply to this post by popej
On 02/12/14 12:32, Andrzej Popowski wrote:
> I'm afraid drive-on=detect could fail for my maps, for example if a tile
> contains no roundabouts.

Does drive-on-left / right make any difference if there are no roundabouts?

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
Hi Steve,

I did not try it, but I would expect different results
when Garmin calculates the fastest route.
A left turn in an "dor" typically takes more time
than a right turn.

Gerd
 
Steve Ratcliffe wrote
On 02/12/14 12:32, Andrzej Popowski wrote:
> I'm afraid drive-on=detect could fail for my maps, for example if a tile
> contains no roundabouts.

Does drive-on-left / right make any difference if there are no roundabouts?

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Steve Ratcliffe

Hi Gerd

> I did not try it, but I would expect different results
> when Garmin calculates the fastest route.

Yes I don't know the answer and it certainly could make a
difference, but I do not recall anyone ever saying that it
actually did.

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

popej
In reply to this post by Gerd Petermann
Hi,

 > do you think that we should count all routable ways?

Maybe this could be better?

But my problem is that your algorithm prefer dirve-on-right. If I use
drive-on=detect, then drive-on-right is selected when detect fails
(regardless of detect algorithm). In my opinion, this should be
configurable. I have suggested previously option like that:

drive-on=detect,left

Similarly to:

location-autofill=is_in,nearest

I don't like the idea for single test in case of --check-roundabouts
either. The result is random, what if first found roundabout is mapped
incorrectly? I think roundabout checking and correcting could be
performed after deciding value for drive-on flag.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Steve Ratcliffe
In reply to this post by Gerd Petermann
On 02/12/14 10:00, Gerd Petermann wrote:
> @Steve, WanMil:
> I've added a ThreadLocal<boolean> to TREHeader similar to that in NODHeader,
> but I think it would be better to store that info only once for each thread,
> I just don't know where, maybe MapMaker?
> Besides that I am not sure how this works when we write two different
> TREHeader files
> in one thread (one for the overview map data ovm_*.img)
> (well, the flag in these files is ignored anyway)
> Please suggest a better solution.

This should be treated in a similar way that copyright message are
handled.

Add a method to LoadableMapDataSource and retrieve that value
somewhere in MapBuilder where it can easily be set into both
NOD and TRE.

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
Hi Steve,
Steve Ratcliffe wrote
This should be treated in a similar way that copyright message are
handled.

Add a method to LoadableMapDataSource and retrieve that value
somewhere in MapBuilder where it can easily be set into both
NOD and TRE.
hmm, I'm not happy with that as well. LoadableMapDataSource is an interface that
is used by many sources, most of them have no idea about dol/dor.

Gerd
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v3] drive-on-left/drive-on-right handling

Gerd Petermann
In reply to this post by popej
Hi Andrzej,

okay, I agree. I'll try to implement it that way tomorrow.

Gerd

popej wrote
Hi,

 > do you think that we should count all routable ways?

Maybe this could be better?

But my problem is that your algorithm prefer dirve-on-right. If I use
drive-on=detect, then drive-on-right is selected when detect fails
(regardless of detect algorithm). In my opinion, this should be
configurable. I have suggested previously option like that:

drive-on=detect,left

Similarly to:

location-autofill=is_in,nearest

I don't like the idea for single test in case of --check-roundabouts
either. The result is random, what if first found roundabout is mapped
incorrectly? I think roundabout checking and correcting could be
performed after deciding value for drive-on flag.

--
Best regards,
Andrzej
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev