osmnx icon indicating copy to clipboard operation
osmnx copied to clipboard

Add junction/intersection types to nodes

Open EwoutH opened this issue 5 months ago • 1 comments

Contributing guidelines

  • [X] I understand the contributing guidelines

Documentation

  • [X] My proposal is not addressed by the documentation or examples

Existing issues

  • [X] Nothing similar appears in an existing issue

What problem does your feature proposal solve?

In urban traffic modeling and analysis, understanding the type of junction or intersection is crucial for estimating traffic flow, capacity, and designing efficient transportation systems. Currently, OSMnx provides comprehensive tools for street network retrieval and analysis but lacks explicit functionality to identify and classify junction types directly from OpenStreetMap (OSM) data. This limitation makes it challenging for researchers and practitioners to analyze the impact of different types of intersections on traffic dynamics without manual data enrichment or external processing.

What is your proposed solution?

I propose enhancing OSMnx with functionality to automatically identify and tag junction types during graph creation from OSM data. This feature would extract and utilize OSM tags related to junctions (junction=*, highway=mini_roundabout, highway=traffic_signals, highway=stop, highway=motorway_junction, railway=level_crossing, railway=crossing, highway=crossing) to classify nodes in the street network graph accordingly.

The integration with the existing osmnx.simplification.consolidate_intersections tool should be considered, ensuring that the process of simplifying and consolidating intersections preserves or appropriately aggregates these junction type classifications. This could involve developing algorithms that determine the dominant junction type within a consolidated intersection based on the original node tags or implementing rules to handle complex intersections with multiple junction types.

What alternatives have you considered?

As an alternative, users could manually process and enrich OSMnx graphs with junction types by querying OSM data separately and merging it with OSMnx-generated graphs. However, this approach is cumbersome and inefficient, requiring additional steps and potentially introducing inconsistencies in data handling and integration.

Another possibility involves leveraging external tools or libraries for post-processing OSMnx graphs to classify junctions, but this would not offer the seamless integration and ease of use that could be achieved by native support within OSMnx.

Additional context

API could look something like:

import osmnx as ox

# Example pseudocode for proposed feature usage
location = "Downtown, AnyCity"
network_type = 'drive'
# Proposed feature enhancement to include junction type tagging
G = ox.graph_from_place(location, network_type=network_type, tag_junctions=True)

# Simplify and consolidate intersections while preserving junction type information
G_simplified = ox.consolidate_intersections(G, tolerance=15, rebuild_graph=True, tag_junctions=True)

# Example analysis or visualization leveraging junction type information
junction_types = nx.get_node_attributes(G_simplified, 'junction_type')
# Further processing or visualization code here

Nothing is final, I would just like to open the discussion about tagging junction types.

EwoutH avatar Feb 02 '24 13:02 EwoutH