Ultima attività 2 weeks ago

mjaschen ha revisionato questo gist 3 weeks ago. Vai alla revisione

1 file changed, 437 insertions

trekking-avoid-sett.brf(file creato)

@@ -0,0 +1,437 @@
1 + # *** The trekking profile is for slow travel
2 + # *** and avoiding car traffic, but still with
3 + # *** a focus on approaching your destination
4 + # *** efficiently.
5 +
6 + ---context:global # following code refers to global config
7 +
8 + # Bike profile
9 + assign validForBikes = true
10 +
11 + # Use the following switches to change behaviour
12 + assign allow_steps = true # %allow_steps% | Set false to disallow steps | boolean
13 + assign allow_ferries = true # %allow_ferries% | Set false to disallow ferries | boolean
14 + assign ignore_cycleroutes = false # %ignore_cycleroutes% | Set true for better elevation results | boolean
15 + assign stick_to_cycleroutes = false # %stick_to_cycleroutes% | Set true to just follow cycleroutes | boolean
16 + assign use_proposed_cycleroutes = false # %use_proposed_cycleroutes% | Set to true to consider proposed and regular cycleroutes as equals | boolean
17 + assign avoid_unsafe = false # %avoid_unsafe% | Set true to avoid standard highways | boolean
18 +
19 + assign add_beeline = false # %add_beeline% | Enable beeline on distant start/end points | boolean
20 +
21 + assign consider_noise = false # %consider_noise% | Activate to prefer a low-noise route | boolean
22 + assign consider_river = false # %consider_river% | Activate to prefer a route along rivers, lakes, etc. | boolean
23 + assign consider_forest = false # %consider_forest% | Activate to prefer a route in forest or parks | boolean
24 + assign consider_town = false # %consider_town% | Activate to bypass cities / big towns as far as possible | boolean
25 + assign consider_traffic = false # %consider_traffic% | Activate to consider traffic estimates | boolean
26 +
27 +
28 +
29 + # Change elevation parameters
30 + assign consider_elevation = true # %consider_elevation% | Set true to favor a route with few elevation meters | boolean
31 +
32 + assign downhillcost = 60 # %downhillcost% | Cost for going downhill | number
33 + assign downhillcutoff = 1.5 # %downhillcutoff% | Gradients below this value in percents are not counted. | number
34 + assign uphillcost = 0 # %uphillcost% | Cost for going uphill | number
35 + assign uphillcutoff = 1.5 # %uphillcutoff% | Gradients below this value in percents are not counted. | number
36 +
37 + assign downhillcost = if consider_elevation then downhillcost else 0
38 + assign uphillcost = if consider_elevation then uphillcost else 0
39 +
40 + # Kinematic model parameters (travel time computation)
41 + assign totalMass = 90 # %totalMass% | Mass (in kg) of the bike + biker, for travel time computation | number
42 + assign maxSpeed = 45 # %maxSpeed% | Absolute maximum speed (in km/h), for travel time computation | number
43 + assign S_C_x = 0.225 # %S_C_x% | Drag coefficient times the reference area (in m^2), for travel time computation | number
44 + assign C_r = 0.01 # %C_r% | Rolling resistance coefficient (dimensionless), for travel time computation | number
45 + assign bikerPower = 100 # %bikerPower% | Average power (in W) provided by the biker, for travel time computation | number
46 +
47 + # Turn instructions settings
48 + assign turnInstructionMode = 1 # %turnInstructionMode% | Mode for the generated turn instructions | [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style]
49 + assign turnInstructionCatchingRange = 40 # %turnInstructionCatchingRange% | Within this distance (in m) several turning instructions are combined into one and the turning angles are better approximated to the general direction | number
50 + assign turnInstructionRoundabouts = true # %turnInstructionRoundabouts% | Set "false" to avoid generating special turning instructions for roundabouts | boolean
51 + assign considerTurnRestrictions = true # %considerTurnRestrictions% | Set true to take turn restrictions into account | boolean
52 +
53 + # with engine defaults, long parts of routing to via points may be removed
54 + assign correctMisplacedViaPoints = false # %correctMisplacedViaPoints% | Set to true to remove detours due to via points (going back and forth on the same route) | boolean
55 + assign correctMisplacedViaPointsDistance = 400 # %correctMisplacedViaPointsDistance% | Only remove detours shorter than this (one-way) distance (in m) (engine defaults to 0 which removes detours whatever their length) | number
56 +
57 + assign processUnusedTags = true # %processUnusedTags% | Set true to output unused tags in data tab | boolean
58 +
59 + ---context:way # following code refers to way-tags
60 +
61 + # classifier constants
62 + assign classifier_none = 1
63 + assign classifier_ferry = 2
64 +
65 + #
66 + # pre-calculate some logical expressions
67 + #
68 +
69 + assign any_cycleroute =
70 + if not use_proposed_cycleroutes then
71 + if route_bicycle_icn=yes then true
72 + else if route_bicycle_ncn=yes then true
73 + else if route_bicycle_rcn=yes then true
74 + else if route_bicycle_lcn=yes then true
75 + else false
76 + else
77 + if route_bicycle_icn=yes|proposed then true
78 + else if route_bicycle_ncn=yes|proposed then true
79 + else if route_bicycle_rcn=yes|proposed then true
80 + else if route_bicycle_lcn=yes|proposed then true
81 + else false
82 +
83 + assign nodeaccessgranted =
84 + if any_cycleroute then true
85 + else lcn=yes
86 +
87 + assign is_ldcr =
88 + if ignore_cycleroutes then false
89 + else any_cycleroute
90 +
91 + # set isbike considering access, local cycle route or the presence of a cycleway on the highway
92 + assign hasbikerouteoraccess =
93 + or bicycle_road=yes or cyclestreet=yes or bicycle=yes|permissive|designated lcn=yes
94 +
95 + assign hascycleway = not
96 + and ( or cycleway= cycleway=no|none ) and ( or cycleway:left= cycleway:left=no ) and ( or cycleway:right= cycleway:right=no ) ( or cycleway:both= cycleway:both=no )
97 +
98 + assign isbike = or hasbikerouteoraccess hascycleway
99 +
100 + assign ispaved = or surface=paved|asphalt|concrete|paving_stones|sett smoothness=excellent|good
101 + assign isunpaved = not or ispaved or ( and surface= smoothness= ) or surface=fine_gravel|cobblestone smoothness=intermediate|bad
102 + assign probablyGood = or ispaved and ( or isbike highway=footway ) not isunpaved
103 +
104 +
105 + #
106 + # this is the cost (in Meter) for a 90-degree turn
107 + # The actual cost is calculated as turncost*cos(angle)
108 + # (Suppressing turncost while following longdistance-cycleways
109 + # makes them a little bit more magnetic)
110 + #
111 + assign turncost = if is_ldcr then 0
112 + else if junction=roundabout then 0
113 + else 90
114 +
115 +
116 + #
117 + # for any change in initialclassifier, initialcost is added once
118 + #
119 + assign initialclassifier =
120 + if route=ferry then classifier_ferry
121 + else classifier_none
122 +
123 +
124 + #
125 + # calculate the initial cost
126 + # this is added to the total cost each time the costfactor
127 + # changed
128 + #
129 + assign initialcost =
130 + if ( equal initialclassifier classifier_ferry ) then 10000
131 + else 0
132 +
133 + #
134 + # implicit access here just from the motorroad tag
135 + # (implicit access rules from highway tag handled elsewhere)
136 + #
137 + assign defaultaccess =
138 + if access= then not motorroad=yes
139 + else if access=private|no then false
140 + else true
141 +
142 + #
143 + # calculate logical bike access
144 + #
145 + assign bikeaccess =
146 + if bicycle= then
147 + (
148 + if bicycle_road=yes then true
149 + else if vehicle= then ( if highway=footway then false else defaultaccess )
150 + else not vehicle=private|no
151 + )
152 + else not bicycle=private|no|dismount|use_sidepath
153 +
154 + #
155 + # calculate logical foot access
156 + #
157 + assign footaccess =
158 + if bicycle=dismount then true
159 + else if foot= then defaultaccess
160 + else not foot=private|no|use_sidepath
161 +
162 + #
163 + # if not bike-, but foot-access, just a moderate penalty,
164 + # otherwise access is forbidden
165 + #
166 + assign accesspenalty =
167 + if bikeaccess then 0
168 + else if footaccess then 4
169 + else if any_cycleroute then 15
170 + else if bicycle=use_sidepath then 25
171 + else 10000
172 +
173 + #
174 + # handle one-ways. On primary roads, wrong-oneways should
175 + # be close to forbidden, while on other ways we just add
176 + # 4 to the costfactor (making it at least 5 - you are allowed
177 + # to push your bike)
178 +
179 + # are we against legal direction on a oneway?
180 + assign badoneway =
181 + if reversedirection=yes then
182 + if oneway:bicycle=yes then true
183 + else if oneway= then junction=roundabout
184 + else oneway=yes|true|1
185 + else oneway=-1
186 +
187 + assign onewaypenalty =
188 + if ( badoneway ) then
189 + (
190 + if (
191 + and hascycleway
192 + or and cycleway:left=lane|track|shared_lane|share_busway
193 + cycleway:left:oneway=no|-1
194 + or and cycleway:right=lane|track|shared_lane|share_busway
195 + cycleway:right:oneway=no|-1
196 + or and cycleway:both=lane|track|shared_lane|share_busway
197 + #or cycleway:both:oneway=no|-1
198 + or cycleway:left:oneway=no|-1
199 + cycleway:right:oneway=no|-1
200 + or cycleway=opposite|opposite_lane|opposite_track
201 + or cycleway:left=opposite|opposite_lane|opposite_track
202 + cycleway:right=opposite|opposite_lane|opposite_track
203 + ) then 0
204 + else if ( oneway:bicycle=no ) then 0
205 + else if ( not footaccess ) then 100
206 + else if ( junction=roundabout|circular ) then 60
207 + else if ( highway=primary|primary_link ) then 50
208 + else if ( highway=secondary|secondary_link ) then 30
209 + else if ( highway=tertiary|tertiary_link ) then 20
210 + else 4.0
211 + )
212 + else 0.0
213 +
214 + # add estimate tags
215 + assign traffic_penalty
216 + switch consider_traffic
217 + switch estimated_traffic_class= 0
218 + switch estimated_traffic_class=1|2 0.2
219 + switch estimated_traffic_class=3 0.4
220 + switch estimated_traffic_class=4 0.6
221 + switch estimated_traffic_class=5 0.8
222 + switch estimated_traffic_class=6|7 1 99 0
223 +
224 +
225 + assign noise_penalty
226 + switch consider_noise
227 + switch estimated_noise_class= 0
228 + switch estimated_noise_class=1 0.3
229 + switch estimated_noise_class=2 0.5
230 + switch estimated_noise_class=3 0.8
231 + switch estimated_noise_class=4 1.4
232 + switch estimated_noise_class=5 1.7
233 + switch estimated_noise_class=6 2 0 0
234 +
235 + assign no_river_penalty
236 + switch consider_river
237 + switch estimated_river_class= 2
238 + switch estimated_river_class=1 1.3
239 + switch estimated_river_class=2 1
240 + switch estimated_river_class=3 0.7
241 + switch estimated_river_class=4 0.4
242 + switch estimated_river_class=5 0.1
243 + switch estimated_river_class=6 0 99 0
244 +
245 + assign no_forest_penalty
246 + switch consider_forest
247 + switch estimated_forest_class= 1
248 + switch estimated_forest_class=1 0.5
249 + switch estimated_forest_class=2 0.4
250 + switch estimated_forest_class=3 0.25
251 + switch estimated_forest_class=4 0.15
252 + switch estimated_forest_class=5 0.1
253 + switch estimated_forest_class=6 0 99 0
254 +
255 + assign town_penalty
256 + switch consider_town
257 + switch estimated_town_class= 0
258 + switch estimated_town_class=1 0.5
259 + switch estimated_town_class=2 0.9
260 + switch estimated_town_class=3 1.2
261 + switch estimated_town_class=4 1.3
262 + switch estimated_town_class=5 1.4
263 + switch estimated_town_class=6 1.6 99 0
264 +
265 + #
266 + # calculate the cost-factor, which is the factor
267 + # by which the distance of a way-segment is multiplied
268 + # to calculate the cost of that segment. The costfactor
269 + # must be >=1 and it's supposed to be close to 1 for
270 + # the type of way the routing profile is searching for
271 + #
272 + assign isresidentialorliving = or highway=residential|living_street living_street=yes
273 + assign costfactor
274 +
275 + #
276 + # exclude rivers, rails etc.
277 + #
278 + if ( and highway= not route=ferry ) then 10000
279 +
280 + #
281 + # exclude motorways and proposed, abandoned under construction roads
282 + #
283 + else if ( highway=motorway|motorway_link ) then 10000
284 + else if ( highway=proposed|abandoned|construction ) then 10000
285 +
286 + #
287 + # all other exclusions below (access, steps, ferries,..)
288 + # should not be deleted by the decoder, to be available
289 + # in voice-hint-processing
290 + #
291 + else min 9999
292 +
293 + add town_penalty
294 + add no_forest_penalty
295 + add no_river_penalty
296 + add noise_penalty
297 + add traffic_penalty
298 + add if ( surface=sett|cobblestone ) then 5 else 0
299 +
300 + #
301 + # apply oneway-and access-penalties
302 + #
303 + add max onewaypenalty accesspenalty
304 +
305 + #
306 + # steps and ferries are special. Note this is handled
307 + # before the cycleroute-switch, to be able
308 + # to really exclude them be setting cost to infinity
309 + #
310 + if ( highway=steps ) then ( if allow_steps then 40 else 10000 )
311 + else if ( route=ferry ) then ( if allow_ferries then 5.67 else 10000 )
312 +
313 + #
314 + # handle long-distance cycle-routes.
315 + #
316 + else if ( is_ldcr ) then 1 # always treated as perfect (=1)
317 + else
318 + add ( if stick_to_cycleroutes then 0.5 else 0.05 ) # everything else somewhat up
319 +
320 + #
321 + # some other highway types
322 + #
323 + if ( highway=pedestrian ) then ( if isbike then ( if hascycleway then 1.1 else 2.2 ) else 3 )
324 + else if ( highway=bridleway ) then 5
325 + else if ( highway=cycleway ) then 1
326 + else if ( isresidentialorliving ) then ( if isunpaved then 1.5 else 1.1 )
327 + else if ( highway=service ) then ( if isunpaved then 1.6 else 1.3 )
328 +
329 + #
330 + # tracks and track-like ways are rated mainly be tracktype/grade
331 + # But note that if no tracktype is given (mainly for road/path/footway)
332 + # it can be o.k. if there's any other hint for quality
333 + #
334 + else if ( highway=track|road|path|footway ) then
335 + (
336 + if ( tracktype=grade1 ) then ( if probablyGood then 1.0 else 1.3 )
337 + else if ( tracktype=grade2 ) then ( if probablyGood then 1.1 else 2.0 )
338 + else if ( tracktype=grade3 ) then ( if probablyGood then 1.5 else 3.0 )
339 + else if ( tracktype=grade4 ) then ( if probablyGood then 2.0 else 5.0 )
340 + else if ( tracktype=grade5 ) then ( if probablyGood then 3.0 else 5.0 )
341 + else ( if probablyGood then 1.0 else 5.0 )
342 + )
343 +
344 + #
345 + # When avoiding unsafe ways, avoid highways without a bike hint
346 + #
347 + else add ( if ( and avoid_unsafe not isbike ) then 2 else 0 )
348 +
349 + #
350 + # actuals roads are o.k. if we have a bike hint
351 + #
352 + if ( highway=trunk|trunk_link ) then ( if isbike then 1.5 else 10 )
353 + else if ( highway=primary|primary_link ) then ( if isbike then 1.2 else 3 )
354 + else if ( highway=secondary|secondary_link ) then ( if isbike then 1.1 else 1.6 )
355 + else if ( highway=tertiary|tertiary_link ) then ( if isbike then 1.0 else 1.4 )
356 + else if ( highway=unclassified ) then ( if isbike then 1.0 else 1.3 )
357 +
358 + #
359 + # default for any other highway type not handled above
360 + #
361 + else 2.0
362 +
363 +
364 + # way priorities used for voice hint generation
365 +
366 + assign priorityclassifier =
367 +
368 + if ( highway=motorway ) then 30
369 + else if ( highway=motorway_link ) then 29
370 + else if ( highway=trunk ) then 28
371 + else if ( highway=trunk_link ) then 27
372 + else if ( highway=primary ) then 26
373 + else if ( highway=primary_link ) then 25
374 + else if ( highway=secondary ) then 24
375 + else if ( highway=secondary_link ) then 23
376 + else if ( highway=tertiary ) then 22
377 + else if ( highway=tertiary_link ) then 21
378 + else if ( highway=unclassified ) then 20
379 + else if ( isresidentialorliving ) then 6
380 + else if ( highway=service ) then 6
381 + else if ( highway=cycleway ) then 6
382 + else if ( or bicycle=designated bicycle_road=yes ) then 6
383 + else if ( highway=track ) then if tracktype=grade1 then 6 else 4
384 + else if ( highway=bridleway|road|path|footway ) then 4
385 + else if ( highway=steps ) then 2
386 + else if ( highway=pedestrian ) then 2
387 + else 0
388 +
389 + # some more classifying bits used for voice hint generation...
390 +
391 + assign isbadoneway = not equal onewaypenalty 0
392 + assign isgoodoneway = if reversedirection=yes then oneway=-1
393 + else if oneway= then junction=roundabout else oneway=yes|true|1
394 + assign isroundabout = junction=roundabout
395 + assign islinktype = highway=motorway_link|trunk_link|primary_link|secondary_link|tertiary_link
396 + assign isgoodforcars = if greater priorityclassifier 6 then true
397 + else if ( or isresidentialorliving highway=service ) then true
398 + else if ( and highway=track tracktype=grade1 ) then true
399 + else false
400 +
401 + # ... encoded into a bitmask
402 +
403 + assign classifiermask add isbadoneway
404 + add multiply isgoodoneway 2
405 + add multiply isroundabout 4
406 + add multiply islinktype 8
407 + multiply isgoodforcars 16
408 +
409 + # include `smoothness=` tags in the response's WayTags for track analysis
410 + assign dummyUsage = smoothness=
411 +
412 + ---context:node # following code refers to node tags
413 +
414 + assign defaultaccess =
415 + if ( access= ) then true # add default barrier restrictions here!
416 + else if ( access=private|no ) then false
417 + else true
418 +
419 + assign bikeaccess =
420 + if nodeaccessgranted=yes then true
421 + else if bicycle= then
422 + (
423 + if vehicle= then defaultaccess
424 + else not vehicle=private|no
425 + )
426 + else not bicycle=private|no|dismount
427 +
428 + assign footaccess =
429 + if bicycle=dismount then true
430 + else if foot= then defaultaccess
431 + else not foot=private|no
432 +
433 + assign initialcost =
434 + if or highway=traffic_signals and highway=crossing crossing=traffic_signals then 20
435 + else
436 + if bikeaccess then 0
437 + else ( if footaccess then 100 else 1000000 )
Più nuovi Più vecchi