parent
49adf2192a
commit
4b4bc0dde2
@ -45,7 +45,7 @@ function node_function(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ways processing, called from OSRM
|
-- ways processing, called from OSRM
|
||||||
function way_function (way)
|
function way_function (way, result)
|
||||||
-- only route on ways with highway=*
|
-- only route on ways with highway=*
|
||||||
local highway = way.tags:Find("highway")
|
local highway = way.tags:Find("highway")
|
||||||
if (not highway or highway=='') then
|
if (not highway or highway=='') then
|
||||||
@ -65,18 +65,18 @@ function way_function (way)
|
|||||||
|
|
||||||
local cursor = assert( sql_con:execute(sql_query) ) -- execute querty
|
local cursor = assert( sql_con:execute(sql_query) ) -- execute querty
|
||||||
local row = cursor:fetch( {}, "a" ) -- fetch first (and only) row
|
local row = cursor:fetch( {}, "a" ) -- fetch first (and only) row
|
||||||
way.forward_speed = 20.0 -- default speed
|
result.forward_speed = 20.0 -- default speed
|
||||||
|
result.forward_mode = 1
|
||||||
if row then
|
if row then
|
||||||
local val = tonumber(row.val) -- read 'val' from row
|
local val = tonumber(row.val) -- read 'val' from row
|
||||||
if val > 10 then
|
if val > 10 then
|
||||||
way.forward_speed = way.forward_speed / math.log10( val ) -- reduce speed by amount of industry close by
|
-- reduce speed by amount of industry close by
|
||||||
|
result.forward_speed = way.forward_speed / math.log10( val )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cursor:close() -- done with this query
|
cursor:close() -- done with this query
|
||||||
|
|
||||||
-- set other required info for this way
|
-- set other required info for this way
|
||||||
way.name = way.tags:Find("name")
|
result.name = way.get_value_by_key("name")
|
||||||
way.direction = Way.bidirectional
|
|
||||||
way.type = 1
|
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user