You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function find_segments(nodes::Dict{Int,T}, highways::Vector{OpenStreetMapX.Way}, intersections::Dict{Int,Set{Int}}) where T<:Union{OpenStreetMapX.ENU,OpenStreetMapX.ECEF}
segments = OpenStreetMapX.Segment[]
intersect = Set(keys(intersections))
for highway in highways
firstNode = 1
for j = 2:length(highway.nodes)
if highway.nodes[firstNode] != highway.nodes[j] && (in(highway.nodes[j], intersect)|| j == length(highway.nodes))
if !reverseway(highway)
seg = OpenStreetMapX.Segment(highway.nodes[firstNode],highway.nodes[j],highway.nodes[firstNode:j], OpenStreetMapX.distance(nodes, highway.nodes[firstNode:j]), highway.id)
push!(segments,seg)
else
seg = OpenStreetMapX.Segment(highway.nodes[j],highway.nodes[firstNode],reverse(highway.nodes[firstNode:j]), OpenStreetMapX.distance(nodes, highway.nodes[firstNode:j]), highway.id)
push!(segments,seg)
end
if !oneway(highway)
seg = OpenStreetMapX.Segment(highway.nodes[j],highway.nodes[firstNode],reverse(highway.nodes[firstNode:j]), OpenStreetMapX.distance(nodes, highway.nodes[firstNode:j]), highway.id)
push!(segments,seg)
end
firstNode = j
end
end
end
return segments
end
Hi, I have a question about the logic of the first if statement. I do not quite understand how it works. I mean, why is it exactly like this? Based on my understanding, highway.nodes[firstNode] is always not the same as highway.nodes[j], right? Moreover, why do we require highway.nodes[j] in the set intersect? It is rather strange to me at least. Could you kindly clarify a little bit?
The text was updated successfully, but these errors were encountered:
Since Ways represent any kind of shape I understand that we can have a situation where the same nodes can occur more than once in a single Way. From graph routing point of view this means having an unnecessary cycle and hence should be avoided. Perhaps @bartoszpankratz can elaborate more on this.
Hi, I have a question about the logic of the first if statement. I do not quite understand how it works. I mean, why is it exactly like this? Based on my understanding,
highway.nodes[firstNode] is always not the same as highway.nodes[j]
, right? Moreover, why do we require highway.nodes[j] in the set intersect? It is rather strange to me at least. Could you kindly clarify a little bit?The text was updated successfully, but these errors were encountered: