Making the turn function more flexible (#4789)
* set and store highway and access classification for the turn function * expose highway turn classification and access turn classification and speed to the lua profile turn function * expose whether connection road at turn is incoming or outgoing * add lua tests for exposed information to turn function * update docs about attributes in process_turn * add turn_classification info to docs * adding warning if uturn and intersection dont match * handle u turns that do not turn into intersection[0] * split OSM link generation in an accessible coordinate function
This commit is contained in:
committed by
GitHub
parent
13bb997525
commit
61e06fcaba
+12
-1
@@ -298,6 +298,14 @@ function setup()
|
||||
|
||||
relation_types = Sequence {
|
||||
"route"
|
||||
},
|
||||
|
||||
-- classify highway tags when necessary for turn weights
|
||||
highway_turn_classification = {
|
||||
},
|
||||
|
||||
-- classify access tags when necessary for turn weights
|
||||
access_turn_classification = {
|
||||
}
|
||||
}
|
||||
end
|
||||
@@ -413,7 +421,10 @@ function process_way(profile, way, result, relations)
|
||||
WayHandlers.names,
|
||||
|
||||
-- set weight properties of the way
|
||||
WayHandlers.weights
|
||||
WayHandlers.weights,
|
||||
|
||||
-- set classification of ways relevant for turns
|
||||
WayHandlers.way_classification_for_turn
|
||||
}
|
||||
|
||||
WayHandlers.run(profile, way, result, data, handlers, relations)
|
||||
|
||||
@@ -221,6 +221,23 @@ function WayHandlers.hov(profile,way,result,data)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- set highway and access classification by user preference
|
||||
function WayHandlers.way_classification_for_turn(profile,way,result,data)
|
||||
local highway = way:get_value_by_key("highway")
|
||||
local access = way:get_value_by_key("access")
|
||||
|
||||
if highway and profile.highway_turn_classification[highway] then
|
||||
assert(profile.highway_turn_classification[highway] < 16, "highway_turn_classification must be smaller than 16")
|
||||
result.highway_turn_classification = profile.highway_turn_classification[highway]
|
||||
end
|
||||
if access and profile.access_turn_classification[access] then
|
||||
assert(profile.access_turn_classification[access] < 16, "access_turn_classification must be smaller than 16")
|
||||
result.access_turn_classification = profile.access_turn_classification[access]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- check accessibility by traversing our access tag hierarchy
|
||||
function WayHandlers.access(profile,way,result,data)
|
||||
data.forward_access, data.backward_access =
|
||||
|
||||
Reference in New Issue
Block a user