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
modesare read in one request (or one pass over the local file) with the filters ofget_walk_graph(),get_drive_graph()andget_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 afteroneway(-1against the drawing,reversibleboth ways); cycling afteronewayunlessoneway:bicycle=noor acycleway*=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 fromutov; 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 orterritory.territory (
Polygon|MultiPolygon|GeoDataFrame|None) – Boundary in EPSG:4326 or a GeoDataFrame, used whenosm_idis 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 withoutbicycle=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 defaulthighway,name,lanes,maxspeedandsurface;bridgeandtunnelare always kept.
- Returns:
Undirected multigraph of type
"street". Edges havelength_meter; the flagswalk,drive_forward,drive_backward,bike_forwardandbike_backward(forwardis fromutov); the travel timestime_walk_min,time_drive_minandtime_bike_min, NaN where the mode does not go;categoryfor driving;cycle_infraandltsfor cycling; the kept tags andbridgeandtunnel.time_minis NaN: route on the graph of a mode.- Return type:
- Raises:
ValueError – If
modesis empty or names an unknown mode.