mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
osrm startup helpers added
This commit is contained in:
parent
d9f83425f6
commit
eb091cc1a4
14 changed files with 1928 additions and 0 deletions
29
osrm/lib/destination.lua
Normal file
29
osrm/lib/destination.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local Destination = {}
|
||||
|
||||
function Destination.get_directional_tag(way, is_forward, tag)
|
||||
local v
|
||||
if is_forward then
|
||||
v = way:get_value_by_key(tag .. ':forward') or way:get_value_by_key(tag)
|
||||
else
|
||||
v = way:get_value_by_key(tag .. ':backward') or way:get_value_by_key(tag)
|
||||
end
|
||||
if v then
|
||||
return v.gsub(v, ';', ', ')
|
||||
end
|
||||
end
|
||||
|
||||
-- Assemble destination as: "A59: Düsseldorf, Köln"
|
||||
-- destination:ref ^ ^ destination
|
||||
|
||||
function Destination.get_destination(way, is_forward)
|
||||
ref = Destination.get_directional_tag(way, is_forward, 'destination:ref')
|
||||
dest = Destination.get_directional_tag(way, is_forward, 'destination')
|
||||
street = Destination.get_directional_tag(way, is_forward, 'destination:street')
|
||||
if ref and dest then
|
||||
return ref .. ': ' .. dest
|
||||
else
|
||||
return ref or dest or street or ''
|
||||
end
|
||||
end
|
||||
|
||||
return Destination
|
Loading…
Add table
Add a link
Reference in a new issue