abrensch / brouter

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

Highway with `bicycle=use_sidepath` vs cycleway #357

Open Asteliks opened 2 years ago

Asteliks commented 2 years ago

The algorithm seems too willing to choose a highway with the tag bicycle=use_sidepath street over the designated cycleway. Note that the safety profile has been chosen.

image

<?xml version="1.0" encoding="UTF-8"?>
<!-- track-length = 977 filtered ascend = 4 plain-ascend = 2 cost=1445 energy=0.0kwh time=2m 47s -->
<gpx 
 xmlns="http://www.topografix.com/GPX/1/1" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" 
 version="1.1" 
 creator="BRouter-Web 99.56.1">
 <wpt lat="52.20552928970305" lon="20.953449010849003"><name>from</name><type>from</type></wpt>
 <wpt lat="52.20938836831035" lon="20.96400618553162"><name>to</name><type>to</type></wpt>
 <trk>
  <name>Warszawa (1 km)</name>
  <trkseg>
   <trkpt lat="52.205531" lon="20.953451"><ele>107</ele></trkpt>
   <trkpt lat="52.205536" lon="20.953438"><ele>107</ele></trkpt>
   <trkpt lat="52.206518" lon="20.954189"><ele>107.75</ele></trkpt>
   <trkpt lat="52.206679" lon="20.954344"><ele>108</ele></trkpt>
   <trkpt lat="52.206805" lon="20.954511"><ele>108.5</ele></trkpt>
   <trkpt lat="52.20716" lon="20.954973"><ele>110</ele></trkpt>
   <trkpt lat="52.207184" lon="20.954985"><ele>110</ele></trkpt>
   <trkpt lat="52.207218" lon="20.954981"><ele>110.25</ele></trkpt>
   <trkpt lat="52.207372" lon="20.954891"><ele>110.5</ele></trkpt>
   <trkpt lat="52.207423" lon="20.955123"><ele>110.75</ele></trkpt>
   <trkpt lat="52.207491" lon="20.955378"><ele>110.75</ele></trkpt>
   <trkpt lat="52.207607" lon="20.955837"><ele>110.75</ele></trkpt>
   <trkpt lat="52.207649" lon="20.955997"><ele>110.75</ele></trkpt>
   <trkpt lat="52.207785" lon="20.956505"><ele>110.5</ele></trkpt>
   <trkpt lat="52.20804" lon="20.957459"><ele>111.5</ele></trkpt>
   <trkpt lat="52.208209" lon="20.95808"><ele>111.25</ele></trkpt>
   <trkpt lat="52.208281" lon="20.95835"><ele>111</ele></trkpt>
   <trkpt lat="52.208312" lon="20.958468"><ele>111</ele></trkpt>
   <trkpt lat="52.208458" lon="20.95903"><ele>110.75</ele></trkpt>
   <trkpt lat="52.208708" lon="20.959975"><ele>110</ele></trkpt>
   <trkpt lat="52.20891" lon="20.960739"><ele>108.25</ele></trkpt>
   <trkpt lat="52.208944" lon="20.960862"><ele>108</ele></trkpt>
   <trkpt lat="52.208972" lon="20.960957"><ele>107.75</ele></trkpt>
   <trkpt lat="52.209041" lon="20.96127"><ele>107</ele></trkpt>
   <trkpt lat="52.209066" lon="20.961469"><ele>106.5</ele></trkpt>
   <trkpt lat="52.209072" lon="20.961652"><ele>106</ele></trkpt>
   <trkpt lat="52.209068" lon="20.961813"><ele>106</ele></trkpt>
   <trkpt lat="52.209051" lon="20.961961"><ele>106.25</ele></trkpt>
   <trkpt lat="52.209033" lon="20.962093"><ele>106.25</ele></trkpt>
   <trkpt lat="52.20898" lon="20.962311"><ele>106.5</ele></trkpt>
   <trkpt lat="52.208931" lon="20.962459"><ele>106.5</ele></trkpt>
   <trkpt lat="52.208786" lon="20.96288"><ele>106.75</ele></trkpt>
   <trkpt lat="52.208676" lon="20.963155"><ele>106.5</ele></trkpt>
   <trkpt lat="52.208652" lon="20.963205"><ele>106.5</ele></trkpt>
   <trkpt lat="52.208696" lon="20.963262"><ele>106.5</ele></trkpt>
   <trkpt lat="52.208726" lon="20.963442"><ele>107</ele></trkpt>
   <trkpt lat="52.208764" lon="20.963476"><ele>107</ele></trkpt>
   <trkpt lat="52.209139" lon="20.963797"><ele>108.75</ele></trkpt>
   <trkpt lat="52.209189" lon="20.963823"><ele>109</ele></trkpt>
   <trkpt lat="52.209224" lon="20.963853"><ele>109</ele></trkpt>
   <trkpt lat="52.209264" lon="20.963889"><ele>109</ele></trkpt>
   <trkpt lat="52.209323" lon="20.963962"><ele>109.25</ele></trkpt>
   <trkpt lat="52.209383" lon="20.964015"><ele>109.25</ele></trkpt>
  </trkseg>
 </trk>
</gpx>
Asteliks commented 2 years ago

This may be connected to the high cost of this turn: image

polyscias commented 2 years ago

See #79 and #335, in the current default Trekking profile bicycle=use_sidepath is not given any penalty which is not good and has been fixed in #337. With a new release that fix will be rolled out but until then you can update the profile yourself.

Asteliks commented 2 years ago

Note that the profile used here wasn’t the default Trekking profile but the safety profile and even that didn’t stop the engine from choosing a highway over a cycleway. If I understand you correctly only the Trekking profile will be updated

polyscias commented 2 years ago

The safety profile is not part of the profiles released by brouter, see https://github.com/abrensch/brouter/tree/master/misc/profiles2

So what is the source of the safety profile?

afischerdev commented 2 years ago

'safety' is one of the generated variantes of trekking.brf The variants are ignored for sync by .gitignore Please see generate_profile_variants.sh Used profiles are found on brouter page.

polyscias commented 2 years ago

'safety' is one of the generated variants of trekking.brf

That is good to know and means that with a new release the fix will be also release to the safety profile.

So can this issue be resolved, together with #79 or wait until a new release?

afischerdev commented 2 years ago

I think could be closed direct. sample brings the wanted result when using new trekking.brf. (save or unsafe).

Asteliks commented 2 years ago

I've tried your "sample" but unfortunately it doesn't work for me, the router still chooses the highway over the cycleway:

image

Asteliks commented 2 years ago

'safety' is one of the generated variants of trekking.brf

That is good to know and means that with a new release the fix will be also release to the safety profile.

So can this issue be resolved, together with #79 or wait until a new release?

Just in case I would wait until release

polyscias commented 2 years ago

I've tried your "sample" but unfortunately it doesn't work for me, the router still chooses the highway over the cycleway:

Did you try changing on line 122 of the Trekking profile:

 else not bicycle=private|no|dismount

into:

 else not bicycle=private|no|dismount|use_sidepath
Asteliks commented 2 years ago

I've tried your "sample" but unfortunately it doesn't work for me, the router still chooses the highway over the cycleway:

Did you try changing on line 122 of the Trekking profile:

 else not bicycle=private|no|dismount

into:

 else not bicycle=private|no|dismount|use_sidepath

Ok, now I got it to work. Thanks.

This change leads us to another problem: https://brouter.de/brouter-web/#map=17/52.20936/20.95505/cyclosm&lonlats=20.953449,52.205529;20.954511,52.212012 With these changes the router chooses a poor quality street over the high quality kurhan street: image

polyscias commented 2 years ago

In the lower left-part you see the cost of this route is 1252 and the length 0,9 km, if I force the route over the Kurhan street, the costs are 1302 and the length 0,8 km.

To see why you should press the Spreadsheet icon on the top left.

You will see the $/km is for all segments 1150 (apart from the common first segment) so that is not the difference, but add all turn-costs and you will see why the route via Nowoberestecka/ Filipinki is taken. I.e. this problem fits better under #358

I see you are using the CycleOSM layer and there the Kurhan street is green which means 20 km/h, while the Nowoberestecka has a part dark green, meaning no No motor vehicle access so no through traffic. I see part of Filipinki is Bad surface (ok for cyclocross/trekking/gravel bikes) but all these properties are not accounted for in the Trekking profile.

Asteliks commented 2 years ago

In the lower left-part you see the cost of this route is 1252 and the length 0,9 km, if I force the route over the Kurhan street, the costs are 1302 and the length 0,8 km.

To see why you should press the Spreadsheet icon on the top left.

You will see the $/km is for all segments 1150 (apart from the common first segment) so that is not the difference, but add all turn-costs and you will see why the route via Nowoberestecka/ Filipinki is taken. I.e. this problem fits better under #358

Well not exactly. Without else not bicycle=private|no|dismount|use_sidepath the router chooses Kurhan, without forcing it:

image

While changing to else not bicycle=private|no|dismount|use_sidepath the router goes through "Filipinki":

image

polyscias commented 2 years ago

Well not exactly. Without else not bicycle=private|no|dismount|use_sidepath the router chooses Kurhan, without forcing it

Did you have a look at the spreadsheet tab on why?

I am more than willing to help but would appreciate it if people take the time to do the first part of the analysis itself.