plot_graph_folium¶

Plot a graph as an interactive Leaflet web map.

In [ ]:
# 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__
Out[ ]:
'1.1.2'
In [ ]:
center_point = (37.5661, 126.9783) # (lat, lng) Seoul, South Korea
dist = 1000
dist_type = 'bbox' # "network", "bbox"
network_type = 'drive' # "all_private", "all", "bike", "drive", "drive_service", "walk"

# Create a graph from OSM within some distance of some (lat, lng) point.
G = ox.graph_from_point(
    center_point,
    dist=dist, 
    dist_type=dist_type,
    network_type=network_type,
    simplify=True, 
    retain_all=False, 
    truncate_by_edge=False, 
    clean_periphery=True, 
    custom_filter=None)
In [ ]:
# Plot a graph as an interactive Leaflet web map.
ox.folium.plot_graph_folium(
    G, 
    graph_map=None, 
    popup_attribute=None, 
    tiles='cartodbpositron', 
    zoom=1, 
    fit_bounds=True, 
    edge_color=None, 
    edge_width=None, 
    edge_opacity=None
)
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook