iduedu.get_street_graph

iduedu.get_street_graph(*, osm_id=None, territory=None, modes=('walk', 'drive', 'bike'), simplify=True, keep_largest_subgraph=False, clip_by_territory=False, walk_speed=83.33333333333333, bike_speed=250.0, allow_footways=False, drive_network='drive', osm_edge_tags=None)[source]

Build one street network for walking, driving and cycling, with every street stored once.

The ways of all modes are read in one request (or one pass over the local file) with the filters of get_walk_graph(), get_drive_graph() and get_bike_graph(). For each way and mode the builder decides, as those builders do, whether the mode may use it and in which directions: walking both ways; driving after oneway (-1 against the drawing, reversible both ways); cycling after oneway unless oneway:bicycle=no or a cycleway*=opposite* tag lets bicycles ride against it. Segments are merged into edges only where all of this, and the kept tags, stay the same, so an edge never spans a change for any mode; bridges and tunnels are separate edges. The geometry of every edge runs from u to v; only edges every mode may use both ways or not at all are written against the drawing of their way, so the direction flags of the others keep the drawing. mode_graph() takes the graph of one mode from it.

Parameters:
  • osm_id (int | None) – OSM relation id of the territory boundary. Provide this or territory.

  • territory (Polygon | MultiPolygon | GeoDataFrame | None) – Boundary in EPSG:4326 or a GeoDataFrame, used when osm_id is not given.

  • modes (Iterable[Literal['walk', 'drive', 'bike']]) – Modes to include, any of "walk", "drive" and "bike".

  • simplify (bool) – Merge segments into edges that run from junction to junction.

  • keep_largest_subgraph (bool) – Keep only the largest connected part of the street network.

  • clip_by_territory (bool) – Clip edges by the exact boundary.

  • walk_speed (float) – Walking speed in metres per minute.

  • bike_speed (float) – Cycling speed on flat ground in metres per minute.

  • allow_footways (bool) – Let bicycles use footways and pedestrian streets without bicycle=yes.

  • drive_network (Literal['drive', 'drive_service']) – "drive", or "drive_service" to drive on service roads too.

  • osm_edge_tags (list[str] | None) – OSM tags kept on the edges. By default highway, name, lanes, maxspeed and surface; bridge and tunnel are always kept.

Returns:

Undirected multigraph of type "street". Edges have length_meter; the flags walk, drive_forward, drive_backward, bike_forward and bike_backward (forward is from u to v); the travel times time_walk_min, time_drive_min and time_bike_min, NaN where the mode does not go; category for driving; cycle_infra and lts for cycling; the kept tags and bridge and tunnel. time_min is NaN: route on the graph of a mode.

Return type:

UrbanGraph

Raises:

ValueError – If modes is empty or names an unknown mode.