Calculate basic descriptive geometric and topological measures of a graph.
# OSMnx: New Methods for Acquiring, Constructing, Analyzing, and Visualizing Complex Street Networks
import osmnx as ox
ox.config(use_cache=True, log_console=False)
ox.__version__
'1.1.2'
query = '중구, 서울특별시, 대한민국'
network_type = 'drive' # "all_private", "all", "bike", "drive", "drive_service", "walk"
# Create graph from OSM within the boundaries of some geocodable place(s).
G = ox.graph_from_place(query, network_type=network_type)
# Plot a graph.
fig, ax = ox.plot_graph(G)
/Users/junhyun/.pyenv/versions/3.8.5/envs/openstreetmap/lib/python3.8/site-packages/osmnx/geocoder.py:110: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead. gdf = gdf.append(_geocode_query_to_gdf(q, wr, by_osmid))
# Calculate basic descriptive geometric and topological measures of a graph.
ox.stats.basic_stats(
G,
area=None,
clean_int_tol=None
)
{'n': 1935,
'm': 5138,
'k_avg': 5.310594315245478,
'edge_length_total': 322628.4209999995,
'edge_length_avg': 62.79260821331248,
'streets_per_node_avg': 3.0702842377260984,
'streets_per_node_counts': {0: 0,
1: 168,
2: 5,
3: 1305,
4: 439,
5: 17,
6: 0,
7: 1},
'streets_per_node_proportions': {0: 0.0,
1: 0.08682170542635659,
2: 0.002583979328165375,
3: 0.6744186046511628,
4: 0.2268733850129199,
5: 0.008785529715762274,
6: 0.0,
7: 0.0005167958656330749},
'intersection_count': 1767,
'street_length_total': 188191.2540000002,
'street_segment_count': 2924,
'street_length_avg': 64.36089398084822,
'circuity_avg': 1.0394819374931508,
'self_loop_proportion': 0.0}