Basic destination sign handling.
This first part in our Exit Sign / Destination Sign quest re-wires the `destination=` and `destination:ref=` tag to the `ref=` tag (in case it's the highway does not already have a `ref=` tag). Doing some analysis on both Berlin and San Francisco it looks like this will add a couple of thousand `ref=` tags that we will announce in guidance. References: - https://github.com/Project-OSRM/osrm-backend/issues/2267#issuecomment-214771682 - http://wiki.openstreetmap.org/wiki/Key:destination - http://wiki.openstreetmap.org/wiki/Proposed_features/Destination_details
This commit is contained in:
committed by
Patrick Niklaus
parent
1bb88b374e
commit
4cf94319df
@@ -1,6 +1,7 @@
|
||||
-- Car profile
|
||||
|
||||
local find_access_tag = require("lib/access").find_access_tag
|
||||
local get_destination = require("lib/destination").get_destination
|
||||
|
||||
-- Begin of globals
|
||||
barrier_whitelist = { ["cattle_grid"] = true, ["border_control"] = true, ["checkpoint"] = true, ["toll_booth"] = true, ["sally_port"] = true, ["gate"] = true, ["lift_gate"] = true, ["no"] = true, ["entrance"] = true }
|
||||
@@ -352,15 +353,19 @@ function way_function (way, result)
|
||||
-- local barrier = way:get_value_by_key("barrier", "")
|
||||
-- local cycleway = way:get_value_by_key("cycleway", "")
|
||||
local service = way:get_value_by_key("service")
|
||||
local destination = get_destination(way)
|
||||
|
||||
-- Set the name that will be used for instructions
|
||||
local has_ref = ref and "" ~= ref
|
||||
local has_name = name and "" ~= name
|
||||
local has_destination = destination and "" ~= destination
|
||||
|
||||
if has_name and has_ref then
|
||||
result.name = name .. " (" .. ref .. ")"
|
||||
elseif has_ref then
|
||||
result.name = ref
|
||||
elseif has_name and has_destination then
|
||||
result.name = name .. " (" .. destination .. ")"
|
||||
elseif has_name then
|
||||
result.name = name
|
||||
-- else
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
local Destination = {}
|
||||
|
||||
function Destination.get_destination(way)
|
||||
local destination = way:get_value_by_key("destination")
|
||||
local destination_ref = way:get_value_by_key("destination:ref")
|
||||
|
||||
-- Assemble destination as: "A59: Düsseldorf, Köln"
|
||||
-- destination:ref ^ ^ destination
|
||||
|
||||
local rv = ""
|
||||
|
||||
if destination_ref and destination_ref ~= "" then
|
||||
rv = rv .. destination_ref
|
||||
end
|
||||
|
||||
if destination and destination ~= "" then
|
||||
if rv ~= "" then
|
||||
rv = rv .. ": "
|
||||
end
|
||||
|
||||
rv = rv .. string.gsub(destination, ";", ", ")
|
||||
end
|
||||
|
||||
return rv
|
||||
end
|
||||
|
||||
return Destination
|
||||
Reference in New Issue
Block a user