utack / utack_brouter_profile

A BRouter profile for some light touring or commuting with a city bike
13 stars 2 forks source link

Add switch to ignore_cycleway #33

Open Wizit38 opened 2 years ago

Wizit38 commented 2 years ago

Hi I'm trying to add a switch to ignore_cycleway

This is because in Singapore most of our cycleways are non segregated and shared. Their speed limit is 25kmh but at certain times of the day, they are very crowded making it extremely unpleasant to ride. My guess is that cycleways in big cities will face similar issues. With the switch, the tourer can choose to avoid cycleways until outside of town and then switch back to 'normal' routing.

I tried to implement this by adding the following code segment

if ignore_cycleway -> assign hascycleway = false

if ( ignore_cycleway ) then false 
# cycleway in both directions
else if and ( not cycleway= ) ( not cycleway=left|right|no|none|opposite|proposed|unknown ) then true

to replace line 174 of your original code

But it does not seem to work. Any idea why?

(I am testing on cheng san community club to Tuas lamp post 1. The route continues to use the PCN along Ang Mo Kio Ave 6 between Ang Mo Kio Ave 1 & Ang Mo Kio Ave 3 even though I set lefthandtraffic=true. By the way, was the profile supposed to ignore this cycleroute since it is on the opposite side of the road?)

poutnikl commented 2 years ago

I would not mix processing cycleroutes and cycleways, the latter either as highway= cycleway[|left|right]= either highway=cycleway and rather added a switch ignore_cycleways.

Note that for "feature cycleways", you cannot selectively promote, penalize nor avoid just the cycleway part of the road. All that applies to the whole road package, take it or leave it.

Wizit38 commented 2 years ago

Sorry, but I dont understand. What do you mean?

rather you add a switch ignore_cycleways? Do you mean I should rename the switch?

Also, what do you mean by your 2nd part?

poutnikl commented 2 years ago

Rather point out what you do not understand.

I mean to have 2 switches. For cycleroutes ( marking analogical to hiking routes) and for cycleways ( physical structures )

If a cycleway is mapped as feature of the main road, Brouter considers it as a single road, with priority eventually modified by the cycleway presence. You cannot avoid the side "feature cycleway" without avoiding the main road in the same extent. The major road and the side cycleway share as a single way the common costfactor.

Preferring a road with "feature cycleway" is at the same level like preferring a road with a particular surface or highway=* classification.

It is just semantically assumed you take the side cycleway the major road is featured with.

Wizit38 commented 2 years ago

Let me see if I understand correctly. A cycleroute is made up of a collection of cycleways. Is this correct?

In the case of the route that I mentioned, the code segment that I did, was to assign hascycleway false if the switch was set. So I do not understand why brouter is still taking the Ang Mo Kio Park connector cycleway. Did I not code it correctly?

Also, I do not understand why brouter chooses to use the Ang Mo Kio Park connector cycleway since it is on the wrong side of the road. (traffic is on the left hand but the Ang Mo Kio park connector is on the right. I thought the purpose of the lefthandtraffic switch was to have brouter take a cycleway only if it was on the left hand of the road ie same side as traffic)

poutnikl commented 2 years ago

No, a cycleroute is NOT a collection of cycleways, even if some or all sections of a cycleroute MAY go along cycleways.

A cycleway is on physical level, a type of a road, independent or integrated. It is marked ( in Europe ) by the traffic sign of the white bicycle on the round dark blue background ( sometimes also with picture of pedestrian if shared ). Or by horizontal bicycle painting for cycleway tracks or lanes.

A cycleroute is on logical level, a road marking for bicycles, like major roads have their marking for cars, or hiking trails have their marking for hikers. It is marked ( in Europe ) by several ways, typically small rectangles or pointing arrows with black bicycle and route number on yellow background .

Cycleroutes can go along all types of OSM highways bicycles are allowed, typically from highway=path to highway=primary.

utack commented 2 years ago

I will have to think about this a bit more and don't have a quick solution right now Unfortunately it is a bit more complex, as @poutnikl has hinted already Currently there is no easy way to do it, It would include a few things

These can be seen as two subtasks, and it is maybe a good impulse to finally implement point 1 in my profile