-
Notifications
You must be signed in to change notification settings - Fork 2
/
oma-canoe.lua
53 lines (44 loc) · 1.16 KB
/
oma-canoe.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
api_version = 4
Set = require('lib/set')
Sequence = require('lib/sequence')
Handlers = require("lib/way_handlers")
Sequence = require('lib/sequence')
function setup()
return {
properties = {
-- max_speed_for_map_matching = 8/3.6, -- 180kmph -> m/s
-- For routing based on duration, but weighted for preferring certain roads
weight_name = 'routability',
},
default_mode = mode.driving,
default_speed = 6,
up_speed = 0.005,
relation_types = Sequence { "route" }
}
end
function process_way(profile, way, result, relations)
local data = {
waterway = way:get_value_by_key('waterway')
}
if (not data.waterway or data.waterway == '')
then
return
end
if data.waterway == 'stream'
then
return
end
local handlers = Sequence {
WayHandlers.default_mode,
WayHandlers.names
}
WayHandlers.run(profile, way, result, data, handlers, relations)
result.forward_speed= profile.default_speed;
result.backward_speed= profile.up_speed;
result.forward_rate = result.forward_speed;
result.backward_rate = result.backward_speed;
end
return {
setup = setup,
process_way = process_way
}