abrensch / brouter

configurable OSM offline router with elevation awareness, Java + Android
MIT License
476 stars 115 forks source link

avoid cities doesn't avoid small villages #608

Open DolomitesTom opened 11 months ago

DolomitesTom commented 11 months ago

Hi all,

I was told to put this here. I am using Cruiser app with Brouter offline, profile motocycle (car eco) with options avoid motorway avoid residential roads avoid unpaved roads avoid cities vmax set to 60 km/h

test voges.zip

With avoid cities I would expect it to use the main road, D1059 in this case.

grafik

Why does it drive through the small villages on D459?

Is it because the avoid cities option does not include small villages? If so, could I please ask for a change or additional option to also avoid small villages from 500 or 1000 inhabitants (best would be a customizable amount)?

Or how can I force it without extra shaping point to us the D1059 in this case? This is just an example for a general problem that I have with route calculation.

With a motorcycle you normally want to take detours, even wider detours in order to not to drive through cities when it is avoidable (sometimes it is not, but in such cases it would be).

Would an extra option be possible which is called accept detour up to X kilometer (X customizable)?

quaelnix commented 11 months ago

Why does it drive through the small villages on D459?

Because cities with less than 50,000 inhabitants are currently not considered, see: https://github.com/abrensch/brouter/issues/486#issuecomment-1647665358 ff.

quaelnix commented 11 months ago
Population based town class Building density based town class
building_density_based

RD5 file with building density based estimated_town_class pseudo tags for the alsace: E5_N45.rd5.zip

Test route: https://brouter.de/brouter-web/#map=14/48.2593/7.2437/standard&...&profile=car-eco

...

assign maxspeed =
    switch estimated_town_class=   maxspeed
    switch estimated_town_class=1  multiply maxspeed 0.9
    switch estimated_town_class=2  multiply maxspeed 0.8
    switch estimated_town_class=3  multiply maxspeed 0.6
    switch estimated_town_class=4  multiply maxspeed 0.5
    switch estimated_town_class=5  multiply maxspeed 0.4
    switch estimated_town_class=6  multiply maxspeed 0.3 maxspeed

assign costfactor = if equal maxspeed 0 then 10000 else 0
DolomitesTom commented 11 months ago

This sounds nice, thank you. But I don't understand the calculation behind because I don't know the town class. What do the numbers represent?

Additionally I hope that devemux86 can implement this in the internal settings.

quaelnix commented 11 months ago

This sounds nice

It is nice and I truely hope that we will manage to implement this concept properly in the near future.

But I don't understand the calculation behind because I don't know the town class.

The idea behind my variant of the estimated_town_class tag is that it should represent how urban the immediate surroundings of the respective street are. estimated_town_class=6 simply means that there are houses everywhere on both sides of the street. While estimated_town_class=1 means that there are some houses somewhere on the street.

Additionally I hope that devemux86 can implement this in the internal settings.

This will only be possible if we change the calculation of the estimated_town_class tag.

Or how can I force it without extra shaping point to us the D1059 in this case?

You could add an additional penalty for highway=traffic_signals|crossing like so:

assign initialcost =
       switch and avoid_toll barrier=toll_booth 1000000
       switch caraccess
              switch highway=traffic_signals|crossing 100 0
              1000000
devemux86 commented 11 months ago

You could add an additional penalty for highway=traffic_signals|crossing

@quaelnix thanks nice hint! I will check it.

quaelnix commented 11 months ago

@devemux86, adding mild penalties for railway=level_crossing, railway=crossing and not traffic_calming= might also help.

devemux86 commented 11 months ago

@quaelnix thanks for the hints!

Regarding the penalty, value 100 sometimes returns the same result, for example this route. Penalty of 1000 or 10000 returns different results.

quaelnix commented 11 months ago

I'm not a motorcyclist and don't know this area, but after playing around with the values a bit, here's what I would do:

...

assign maxspeed switch highway=unclassified multiply maxspeed 0.5 maxspeed

assign costfactor = if equal maxspeed 0 then 10000 else 0
...

assign initialcost =
       switch and avoid_toll barrier=toll_booth 1000000
       switch caraccess
              switch railway=level_crossing|crossing  2500
              switch highway=traffic_signals|crossing 150 0
              1000000

Or how can I force it without extra shaping point to us the D1059 in this case?

You could also try something like this:

...

assign maxspeed switch ( not highway=motorway|trunk|primary ) multiply maxspeed 0.4 maxspeed

assign costfactor = if equal maxspeed 0 then 10000 else 0

Penalty of 1000 or 10000 returns different results.

The optimal weighting for such penalties can only be determined through extensive testing, which can take many hours.

EssBee59 commented 11 months ago

Hello Dolomitee! As explained above, the town tag is a low cost solution (data storage and processing) to help users to bypass big towns and cities. For me, it is well running (of course, it should be used by the calculation of a long route!)

I have no motorbike, but I do not understand the requirements you put together:

avoid residential roads avoid unpaved roads avoid cities

Avoid cities is ok for me, I hate to cross cities/big towns on the bike! Avoid unpaved roads is ok for me, I have the same request on my fastbike

But "avoid residential roads" is not clear: What should do the Brouter, if you try to bypass all the villages in your route "Voges"?

The situation is I think similar when you try to consider "traffic_signal" in a profile. The calculated routes for racebike was not better (yes, really badder), after some tests I gave up!

A town ta for villages is theoretically possible (with high costs). I am waiting since monthes on a use case (you have possibly a solution to route outside each village in your example?)

DolomitesTom commented 11 months ago

I only use the internal cruiser settings. The rest is too complicated for me. With Avoid residential road I would like to use a detour instead of driving through the village if available. If it doesn't work that well, then I just set a shaping point, ok for me. If Brouter settings are getting high sophisticated and devemux can use it to enhance the result, perfect.

EssBee59 commented 11 months ago

"Avoid residential roads" Please clarify what it means!

I think/suspect now, it means the OSM roads mapped as "highway=residential". In a village/town/city, most of the roads are "highway=residential", exceptions are the main roads which are generally Highway=primary/secondarx/tertiary.

If so, avoid residential only means, in villages/town/cities remain on the main roads, do not use the residential roads... and this is extremly easy, as the highway tag is allways available!

"With Avoid residential road I would like to use a detour instead of driving through the village if available." if availble ... hard to evaluate the cases: but you can as example start a test by setting "nogo areas" on each village of your route.

(Today, using the tag "max-speed", profiles should be able to favor a detour if available),

devemux86 commented 11 months ago

@EssBee59

Cruiser's custom driving BRouter profile is available here:

For the "Avoid residential roads" we use the tags highway=residential|service|living_street.

devemux86 commented 11 months ago

(Today, using the tag "max-speed", profiles should be able to favor a detour if available),

@EssBee59 do you mean the vmax parameter in profiles? This is also available as an option.

EssBee59 commented 11 months ago

About the maxspeed tag.. in your profile you have this section:

assign maxspeed_explicit = switch maxspeed=50 50 switch maxspeed=30 30 switch maxspeed=10 10 switch maxspeed=20 20 switch maxspeed=40 40 switch maxspeed=60 60 switch maxspeed=70 70 switch maxspeed=80 80 switch maxspeed=90 90 switch maxspeed=100 100 switch maxspeed=110 110 switch maxspeed=120 120 switch maxspeed=130 130 switch maxspeed=urban 50 switch maxspeed=rural 100 if reversedirection=yes then maxspeed_backward else maxspeed_forward

The idea, if you prefer a detour to a road in a village is to favor a route with a maxspeed higher than 30 and 50... (Sorry, the logic of your profile is very complex, I could not see the impact of the maxspeed parameter on the routing. Possibly it is allready so implemented)

DolomitesTom commented 11 months ago

This is how I understand it, use the main roads in smaller villages, if so then avoid residential roads is the right setting.

setting "nogo areas" on each village of your route.

how can I do this in cruiser?

devemux86 commented 11 months ago

how can I do this in cruiser?

@DolomitesTom please see:

EssBee59 commented 11 months ago

Hello,

Ussing "nogo" was just an idea, how to simulate "avoid village" (to show, that a routing + avoid any village ist quite unpossible) To strat the test: 1-load your prodile in the brouter-web (as explained in your cruise documentation) 2- create your route in the Vosges (as defined in the vosges.gpx abobe) 3-create nogo areas in the villages on your route (use the no-go-area button on the left bar)

her, I just tried with 1 nogo area with a car profile... image regards