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
Copy file name to clipboardExpand all lines: src/graph.jl
+29-29Lines changed: 29 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -173,15 +173,15 @@ end
173
173
174
174
175
175
"""
176
-
Adds mappings between nodes, edges and highways to `OSMGraph`.
176
+
Adds mappings between nodes, edges and ways to `OSMGraph`.
177
177
"""
178
178
functionadd_node_and_edge_mappings!(g::OSMGraph{U,T,W}) where {U <:Integer,T <:Integer,W <:Real}
179
-
for (way_id, way) in g.highways
179
+
for (way_id, way) in g.ways
180
180
@inboundsfor (i, node_id) inenumerate(way.nodes)
181
-
ifhaskey(g.node_to_highway, node_id)
182
-
push!(g.node_to_highway[node_id], way_id)
181
+
ifhaskey(g.node_to_way, node_id)
182
+
push!(g.node_to_way[node_id], way_id)
183
183
else
184
-
g.node_to_highway[node_id] = [way_id]
184
+
g.node_to_way[node_id] = [way_id]
185
185
end
186
186
187
187
if i <length(way.nodes)
@@ -193,16 +193,16 @@ function add_node_and_edge_mappings!(g::OSMGraph{U,T,W}) where {U <: Integer,T <
193
193
d = way.nodes[i]
194
194
end
195
195
196
-
g.edge_to_highway[[o, d]] = way_id
196
+
g.edge_to_way[[o, d]] = way_id
197
197
198
198
if!way.tags["oneway"]::Bool
199
-
g.edge_to_highway[[d, o]] = way_id
199
+
g.edge_to_way[[d, o]] = way_id
200
200
end
201
201
end
202
202
end
203
203
end
204
204
205
-
@assert(length(g.nodes) ==length(g.node_to_highway), "Data quality issue: number of graph nodes ($(length(g.nodes::Dict{T,Node{T}}))) not equal to set of nodes extracted from highways ($(length(g.node_to_highway)))")
205
+
@assert(length(g.nodes) ==length(g.node_to_way), "Data quality issue: number of graph nodes ($(length(g.nodes::Dict{T,Node{T}}))) not equal to set of nodes extracted from ways ($(length(g.node_to_way)))")
206
206
g.node_to_index =OrderedDict{T,U}(n => i for (i, n) inenumerate(collect(keys(g.nodes))))
207
207
g.index_to_node =OrderedDict{U,T}(i => n for (n, i) in g.node_to_index)
208
208
end
@@ -215,7 +215,7 @@ function add_node_tags!(g::OSMGraph)
215
215
@inlinefunction_roundedmean(hwys, subkey, T)
216
216
total =zero(T)
217
217
for id in hwys
218
-
total += g.highways[id].tags[subkey]::T
218
+
total += g.ways[id].tags[subkey]::T
219
219
end
220
220
returnround(T, total/length(hwys))
221
221
end
@@ -224,10 +224,10 @@ function add_node_tags!(g::OSMGraph)
224
224
L = DEFAULT_OSM_LANES_TYPE
225
225
226
226
for (id, data) in g.nodes
227
-
highways= g.node_to_highway[id]
227
+
ways= g.node_to_way[id]
228
228
tags_dict = g.nodes[id].tags::Dict{String, Any}
229
-
tags_dict["maxspeed"] =_roundedmean(highways, "maxspeed", M)
Copy file name to clipboardExpand all lines: src/types.jl
+20-7Lines changed: 20 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -86,11 +86,11 @@ Container for storing OpenStreetMap node, way, relation and graph related obejct
86
86
`U <: Integer,T <: Integer,W <: Real`
87
87
- `nodes::Dict{T,Node{T}}`: Mapping of node ids to node objects.
88
88
- `node_coordinates::Vector{Vector{W}}`: Vector of node coordinates [[lat, lon]...], indexed by graph vertices.
89
-
- `highways::Dict{T,Way{T}}`: Mapping of way ids to way objects.
89
+
- `ways::Dict{T,Way{T}}`: Mapping of way ids to way objects. Previously called `highways`.
90
90
- `node_to_index::OrderedDict{T,U}`: Mapping of node ids to graph vertices.
91
91
- `index_to_node::OrderedDict{U,T}`: Mapping of graph vertices to node ids.
92
-
- `node_to_highway::Dict{T,Vector{T}}`: Mapping of node ids to vector of way ids.
93
-
- `edge_to_highway::Dict{Vector{T},T}`: Mapping of edges (adjacent node pairs) to way ids.
92
+
- `node_to_way::Dict{T,Vector{T}}`: Mapping of node ids to vector of way ids. Previously called `node_to_highway`.
93
+
- `edge_to_way::Dict{Vector{T},T}`: Mapping of edges (adjacent node pairs) to way ids. Previously called `edge_to_highway`.
94
94
- `restrictions::Dict{T,Restriction{T}}`: Mapping of relation ids to restriction objects.
95
95
- `indexed_restrictions::Union{DefaultDict{U,Vector{MutableLinkedList{U}}},Nothing}`: Mapping of via node ids to ordered sequences of restricted node ids.
96
96
- `graph::Union{AbstractGraph,Nothing}`: Either DiGraph, StaticDiGraph, SimpleWeightedDiGraph or MetaDiGraph.
@@ -104,11 +104,11 @@ abstract type AbstractOSMGraph end
0 commit comments