geosnap.io.get_network_from_gdf

geosnap.io.get_network_from_gdf(gdf, network_type='walk', twoway=False, add_travel_times=False, default_speeds=None)[source]

Create a pandana.Network object from a geodataframe (via OSMnx graph).

Parameters:
gdfgeopandas.GeoDataFrame

dataframe covering the study area of interest; Note the first step is to take the unary union of this dataframe, which is expensive, so large dataframes may be time-consuming. The network will inherit the CRS from this dataframe

network_typestr, {“all_private”, “all”, “bike”, “drive”, “drive_service”, “walk”}

the type of network to collect from OSM (passed to osmnx.graph_from_polygon) by default “walk”

twowaybool, optional

Whether to treat the pandana.Network as directed or undirected. For a directed network, use twoway=False (which is the default). For an undirected network (e.g. a walk network) where travel can flow in both directions, the network is more efficient when twoway=True but forces the impedance to be equal in both directions. This has implications for auto or multimodal networks where impedance is generally different depending on travel direction.

add_travel_timesbool, default=False

whether to use posted travel times from OSM as the impedance measure (rather than network-distance). Speeds are based on max posted drive speeds, see <https://osmnx.readthedocs.io/en/stable/internals-reference.html#osmnx-speed-module> for more information.

default_speedsdict, optional

default speeds passed assumed when no data available on the OSM edge. Defaults to {“residential”: 35, “secondary”: 50, “tertiary”: 60}. Only considered if add_travel_times is True

Returns:
pandana.Network

a pandana.Network object with node coordinates stored in the same system as the input geodataframe. If add_travel_times is True, the network impedance is travel time measured in seconds (assuming automobile travel speeds); else the impedance is travel distance measured in meters

Raises:
ImportError

requires osmnx, raises if module not available