Skip to content

Commit 9837054

Browse files
committed
update profiles to v5.18.0
1 parent bb7930d commit 9837054

13 files changed

+2740
-1230
lines changed

bike-city.lua

Lines changed: 543 additions & 427 deletions
Large diffs are not rendered by default.

bike-touring.lua

Lines changed: 544 additions & 424 deletions
Large diffs are not rendered by default.

car.lua

Lines changed: 375 additions & 287 deletions
Large diffs are not rendered by default.

foot-city.lua

Lines changed: 52 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22

33
api_version = 1
44

5-
local find_access_tag = require("lib/access").find_access_tag
6-
local Set = require('lib/set')
7-
local Sequence = require('lib/sequence')
8-
local Handlers = require("lib/handlers")
5+
6+
Set = require('lib/set')
7+
Sequence = require('lib/sequence')
8+
Handlers = require("lib/way_handlers")
9+
find_access_tag = require("lib/access").find_access_tag
910
local next = next -- bind to local for speed
1011
local Tags = require('lib/tags')
1112

12-
properties.max_speed_for_map_matching = 40/3.6 -- kmph -> m/s
13-
properties.use_turn_restrictions = false
14-
properties.continue_straight_at_waypoint = false
15-
properties.weight_name = 'routability'
16-
1713
local walking_speed = 10
1814

1915
local profile = {
16+
17+
properties = {
18+
weight_name = 'routability',
19+
max_speed_for_map_matching = 40/3.6, -- kmph -> m/s
20+
call_tagless_node_function = false,
21+
traffic_light_penalty = 2,
22+
u_turn_penalty = 2,
23+
continue_straight_at_waypoint = false,
24+
use_turn_restrictions = false,
25+
},
2026
default_mode = mode.walking,
2127
default_speed = 10,
2228
designated_speed = 12,
@@ -68,11 +74,18 @@ local profile = {
6874
'customers',
6975
},
7076

77+
restricted_highway_whitelist = Set { },
78+
79+
construction_whitelist = Set {},
80+
7181
access_tags_hierarchy = Sequence {
7282
'foot',
7383
'access'
7484
},
7585

86+
-- tags disallow access to in combination with highway=service
87+
service_access_tag_blacklist = Set { },
88+
7689
restrictions = Sequence {
7790
'foot'
7891
},
@@ -137,15 +150,18 @@ local profile = {
137150
bridge_speeds = {
138151
},
139152

140-
surface_penalties = {
141-
["gravel"] = 0.7,
142-
["ground"] = 0.8,
143-
["unpaved"] = 0.8,
144-
["grass"] = 0.5,
145-
["dirt"] = 0.5,
146-
["compacted"] = 0.9,
147-
["grit"] = 0.8,
148-
["sand"] = 0.6
153+
surface_speeds = {
154+
["fine_gravel"] = walking_speed*0.8,
155+
["gravel"] = walking_speed*0.7,
156+
["pebblestone"] = walking_speed*0.7,
157+
["mud"] = walking_speed*0.5,
158+
["ground"] = walking_speed*0.8,
159+
["unpaved"] = walking_speed*0.8,
160+
["grass"] = walking_speed*0.5,
161+
["dirt"] = walking_speed*0.5,
162+
["compacted"] = walking_speed*0.9,
163+
["grit"] = walking_speed*0.8,
164+
["sand"] = walking_speed*0.6
149165
},
150166

151167
tracktype_speeds = {
@@ -238,45 +254,49 @@ function way_function(way, result)
238254
local handlers = Sequence {
239255
-- set the default mode for this profile. if can be changed later
240256
-- in case it turns we're e.g. on a ferry
241-
'handle_default_mode',
257+
WayHandlers.default_mode,
242258

243259
-- check various tags that could indicate that the way is not
244260
-- routable. this includes things like status=impassable,
245261
-- toll=yes and oneway=reversible
246-
'handle_blocked_ways',
262+
WayHandlers.blocked_ways,
247263

248264
-- determine access status by checking our hierarchy of
249265
-- access tags, e.g: motorcar, motor_vehicle, vehicle
250-
'handle_access',
266+
WayHandlers.access,
251267

252268
-- check whether forward/backward directons are routable
253-
'handle_oneway',
269+
WayHandlers.oneway,
254270

255271
-- check whether forward/backward directons are routable
256-
'handle_destinations',
272+
WayHandlers.destinations,
257273

258274
-- check whether we're using a special transport mode
259-
'handle_ferries',
260-
'handle_movables',
275+
WayHandlers.ferries,
276+
WayHandlers.movables,
261277

262278
-- compute speed taking into account way type, maxspeed tags, etc.
263-
'handle_speed_foot',
279+
WayHandlers.speed,
280+
WayHandlers.surface,
264281

265282
-- set speed for path
266-
'adjust_speed_for_path',
283+
WayHandlers.adjust_speed_for_path,
267284

268285
-- handle turn lanes and road classification, used for guidance
269-
'handle_classification',
286+
WayHandlers.classification,
270287

271288
-- handle various other flags
272-
'handle_roundabouts',
273-
'handle_startpoint',
289+
WayHandlers.roundabouts,
290+
WayHandlers.startpoint,
274291

275292
-- set name, ref and pronunciation
276-
'handle_names'
293+
WayHandlers.names,
294+
295+
-- set weight properties of the way
296+
WayHandlers.weights
277297
}
278298

279-
Handlers.run(handlers,way,result,data,profile)
299+
WayHandlers.run(profile, way, result, data, handlers)
280300

281301
if result.forward_rate == -1 and result.forward_speed > 0 then
282302
result.forward_rate = result.forward_speed / 3.6;

foot-hiking.lua

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,27 @@
22

33
api_version = 1
44

5-
local find_access_tag = require("lib/access").find_access_tag
6-
local Set = require('lib/set')
7-
local Sequence = require('lib/sequence')
8-
local Handlers = require("lib/handlers")
5+
6+
Set = require('lib/set')
7+
Sequence = require('lib/sequence')
8+
Handlers = require("lib/way_handlers")
9+
find_access_tag = require("lib/access").find_access_tag
910
local next = next -- bind to local for speed
1011
local Tags = require('lib/tags')
1112

12-
properties.max_speed_for_map_matching = 40/3.6 -- kmph -> m/s
13-
properties.use_turn_restrictions = false
14-
properties.continue_straight_at_waypoint = false
15-
properties.weight_name = 'routability'
16-
1713
local walking_speed = 10
1814

1915
local profile = {
16+
17+
properties = {
18+
weight_name = 'routability',
19+
max_speed_for_map_matching = 40/3.6, -- kmph -> m/s
20+
call_tagless_node_function = false,
21+
traffic_light_penalty = 2,
22+
u_turn_penalty = 2,
23+
continue_straight_at_waypoint = false,
24+
use_turn_restrictions = false,
25+
},
2026
default_mode = mode.walking,
2127
default_speed = 10,
2228
designated_speed = 12,
@@ -68,11 +74,18 @@ local profile = {
6874
'customers',
6975
},
7076

77+
restricted_highway_whitelist = Set { },
78+
79+
construction_whitelist = Set {},
80+
7181
access_tags_hierarchy = Sequence {
7282
'foot',
7383
'access'
7484
},
7585

86+
-- tags disallow access to in combination with highway=service
87+
service_access_tag_blacklist = Set { },
88+
7689
restrictions = Sequence {
7790
'foot'
7891
},
@@ -137,13 +150,14 @@ local profile = {
137150
bridge_speeds = {
138151
},
139152

140-
surface_penalties = {
141-
["gravel"] = 0.9,
142-
["paved"] = 0.8,
143-
["cobblestone"] = 0.8,
144-
["pebblestone"] = 0.8,
145-
["concrete"] = 0.8,
146-
["sand"] = 0.9
153+
surface_speeds = {
154+
["gravel"] = walking_speed*0.9,
155+
["cobblestone"] = walking_speed*0.8,
156+
["pebblestone"] = walking_speed*0.8,
157+
["concrete"] = walking_speed*0.8,
158+
["mud"] = walking_speed*0.5,
159+
["paved"] = walking_speed*0.8,
160+
["sand"] = walking_speed*0.9
147161
},
148162

149163
tracktype_speeds = {
@@ -235,46 +249,50 @@ function way_function(way, result)
235249
local handlers = Sequence {
236250
-- set the default mode for this profile. if can be changed later
237251
-- in case it turns we're e.g. on a ferry
238-
'handle_default_mode',
252+
WayHandlers.default_mode,
239253

240254
-- check various tags that could indicate that the way is not
241255
-- routable. this includes things like status=impassable,
242256
-- toll=yes and oneway=reversible
243-
'handle_blocked_ways',
257+
WayHandlers.blocked_ways,
244258

245259
-- determine access status by checking our hierarchy of
246260
-- access tags, e.g: motorcar, motor_vehicle, vehicle
247-
'handle_access',
261+
WayHandlers.access,
248262

249263
-- check whether forward/backward directons are routable
250-
'handle_oneway',
264+
WayHandlers.oneway,
251265

252266
-- check whether forward/backward directons are routable
253-
'handle_destinations',
267+
WayHandlers.destinations,
254268

255269
-- check whether we're using a special transport mode
256-
'handle_ferries',
257-
'handle_movables',
270+
WayHandlers.ferries,
271+
WayHandlers.movables,
258272

259273
-- compute speed taking into account way type, maxspeed tags, etc.
260-
'handle_speed_foot',
274+
WayHandlers.speed,
275+
WayHandlers.surface,
261276

262277
-- set speed for path
263-
'adjust_speed_for_path',
278+
WayHandlers.adjust_speed_for_path,
264279

265280
-- handle turn lanes and road classification, used for guidance
266-
'handle_classification',
281+
WayHandlers.classification,
267282

268283
-- handle various other flags
269-
'handle_roundabouts',
270-
'handle_startpoint',
284+
WayHandlers.roundabouts,
285+
WayHandlers.startpoint,
271286

272287
-- set name, ref and pronunciation
273-
'handle_names'
274-
}
288+
WayHandlers.names,
275289

276-
Handlers.run(handlers,way,result,data,profile)
290+
-- set weight properties of the way
291+
WayHandlers.weights
292+
}
277293

294+
WayHandlers.run(profile, way, result, data, handlers)
295+
278296
if result.forward_rate == -1 and result.forward_speed > 0 then
279297
result.forward_rate = result.forward_speed / 3.6;
280298
end
@@ -293,7 +311,7 @@ function turn_function (turn)
293311
if turn.has_traffic_light then
294312
turn.duration = profile.traffic_light_penalty
295313
end
296-
314+
297315
-- penalize turns from non-local access only segments onto local access only tags
298316
if not turn.source_restricted and turn.target_restricted then
299317
turn.weight = turn.weight + 3000

lib/guidance.lua

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ local Guidance = {}
66
-- Guidance: Default Mapping from roads to types/priorities
77
highway_classes = {
88
motorway = road_priority_class.motorway,
9-
motorway_link = road_priority_class.link_road,
9+
motorway_link = road_priority_class.motorway_link,
1010
trunk = road_priority_class.trunk,
11-
trunk_link = road_priority_class.link_road,
11+
trunk_link = road_priority_class.trunk_link,
1212
primary = road_priority_class.primary,
13-
primary_link = road_priority_class.link_road,
13+
primary_link = road_priority_class.primary_link,
1414
secondary = road_priority_class.secondary,
15-
secondary_link = road_priority_class.link_road,
15+
secondary_link = road_priority_class.secondary_link,
1616
tertiary = road_priority_class.tertiary,
17-
tertiary_link = road_priority_class.link_road,
18-
unclassified = road_priority_class.side_residential,
19-
residential = road_priority_class.side_residential,
20-
service = road_priority_class.connectivity,
21-
living_street = road_priority_class.main_residential,
17+
tertiary_link = road_priority_class.tertiary_link,
18+
unclassified = road_priority_class.unclassified,
19+
residential = road_priority_class.main_residential,
20+
service = road_priority_class.alley,
21+
living_street = road_priority_class.side_residential,
2222
track = road_priority_class.bike_path,
2323
path = road_priority_class.bike_path,
2424
footway = road_priority_class.foot_path,
@@ -60,17 +60,44 @@ link_types = Set {
6060
'tertiary_link'
6161
}
6262

63+
-- roads like parking lots are very unimportant for normal driving
64+
parking_class = Set{
65+
'parking_aisle',
66+
'driveway',
67+
'drive-through',
68+
'emergency_access'
69+
}
70+
6371
function Guidance.set_classification (highway, result, input_way)
6472
if motorway_types[highway] then
65-
result.road_classification.motorway_class = true;
73+
result.road_classification.motorway_class = true
6674
end
6775
if link_types[highway] then
68-
result.road_classification.link_class = true;
76+
result.road_classification.link_class = true
6977
end
70-
if highway_classes[highway] ~= nil then
71-
result.road_classification.road_priority_class = highway_classes[highway]
78+
79+
-- All service roads are recognised as alley
80+
if highway ~= nil and highway == 'service' then
81+
local service_type = input_way:get_value_by_key('service');
82+
if service_type ~= nil and parking_class[service_type] then
83+
result.road_classification.road_priority_class = road_priority_class.alley
84+
else
85+
if service_type ~= nil and service_type == 'alley' then
86+
result.road_classification.road_priority_class = road_priority_class.alley
87+
else
88+
if serice_type == nil then
89+
result.road_classification.road_priority_class = road_priority_class.alley
90+
else
91+
result.road_classification.road_priority_class = highway_classes[highway]
92+
end
93+
end
94+
end
7295
else
73-
result.road_classification.road_priority_class = default_highway_class
96+
if highway_classes[highway] ~= nil then
97+
result.road_classification.road_priority_class = highway_classes[highway]
98+
else
99+
result.road_classification.road_priority_class = default_highway_class
100+
end
74101
end
75102
if road_types[highway] then
76103
result.road_classification.may_be_ignored = false;
@@ -137,7 +164,7 @@ function Guidance.get_turn_lanes(way,data)
137164
local psv_fw, psv_bw = get_psv_counts(way,data)
138165
local turn_lanes_fw, turn_lanes_bw = Tags.get_forward_backward_by_key(way,data,'turn:lanes')
139166
local vehicle_lanes_fw, vehicle_lanes_bw = Tags.get_forward_backward_by_key(way,data,'vehicle:lanes')
140-
167+
141168
--note: backward lanes swap psv_bw and psv_fw
142169
return process_lanes(turn_lanes_fw,vehicle_lanes_fw,psv_bw,psv_fw) or turn_lanes,
143170
process_lanes(turn_lanes_bw,vehicle_lanes_bw,psv_fw,psv_bw) or turn_lanes

0 commit comments

Comments
 (0)