1- using LightOSM, GeoInterface, Plots, DataFrames
2- using ArchGDAL: createmultilinestring
1+ using LightOSM, Plots
32
43g = graph_from_download (
5- :place_name , place_name= " moabit, berlin germany" ,
4+ :place_name ,
5+ place_name= " tiergarten, berlin germany" ,
66 network_type= :bike
77)
8- # reverse coordinates for plotting
9- reverse! .(g. node_coordinates)
10-
11- g_simple, weights, node_gdf, edge_gdf = simplify_graph (g)
12-
13- # join edges in mulitlinestring for faster plotting
14- all_edges = createmultilinestring (coordinates .(edge_gdf. geom))
15-
16- # node validation
17-
18- # nodes from original graph
19- plot (all_edges, color= :black , size= (1200 ,800 ))
20- scatter! (first .(g. node_coordinates), last .(g. node_coordinates), color= :red )
21-
22- # nodes from simplified graph
23- plot (all_edges, color= :black , size= (1200 ,800 ))
24- scatter! (node_gdf. geom, color= :green )
25-
26-
27- # edge validation
28-
29- function highway_gdf (osmg:: OSMGraph )
30- function _geometrize_way (way)
31- createlinestring (map (id -> coordinates (osmg. nodes[id]), way. nodes))
32- end
33- geom = map (way -> _geometrize_way (way), values (osmg. highways))
34- return DataFrame (; id = collect (keys (osmg. highways)), geom)
35- end
36-
8+ sg = simplify_graph (g)
9+
10+ # check for missing edges
11+ plot (g, color= :red , linewidth= 0.8 )
12+ plot! (edge_gdf (sg). geom, linewidth= 1.1 , color= :black )
13+ savefig (" edge_validation" )
14+
15+ # show original nodes
16+ plot (sg)
17+ plot! (node_gdf (g). geom, color= :red , markersize= 2.2 )
18+ savefig (" original_nodes" )
19+
20+ # show relevant nodes
21+ plot (sg)
22+ plot! (node_gdf (sg). geom, color= :green , markersize= 2.2 )
23+ savefig (" relevant_nodes" )
0 commit comments