StreetContinuity (SC) is a python library that implements both Intersection Continuity Negotiation (ICN) and Hierarchical Intersection Continuity Negotiation (HICN). ICN was first proposed by Porta et al. (2006) and further enhanced by Masucci et al. (2014), who advanced with the HICN approach.
For details about each implementation, please refer to:
I want to thank Elisabeth H. Krueger and Xianyuan Zhan, who provide me with their version of the HICN. Their code gave some insights and helped in the process of validation of the results.
For details about their implementation, please refer to:
- numpy (1.26.2)
- osmnx (1.7.1)
- networkx (3.2.1)
After downloading the SC library, install it on Python 3 using the following commands:
pip3 install . --user
import osmnx as ox
from street_continuity.all import *
# load the primal graph from osmnx
oxg = ox.graph_from_point((-22.012282, -47.890821), distance=5000)
p_graph = from_osmnx(oxg=oxg, use_label=True)
# alternatively, you can load the graph from a csv file
# p_graph = read_csv(nodes_filename='test-nodes.csv', edges_filename='test-edges.csv', directory='data', use_label=True, has_header=False)
# maps the primal graph to the dual representation
# use_label = True: uses HICN algorithm
# use_label = False: uses ICN algorithm
d_graph = dual_mapper(primal_graph=p_graph, min_angle=90)
# you must create the data directory before running this command
dxg = write_graphml(graph=d_graph, filename='file.graphml', directory='data')
write_supplementary(graph=d_graph, filename='supplementary.txt', directory='data')
This is the resulting graph using Gephi (0.9.2) and OpenOrd layout with default parameters:
Primal Graph (from OSMNX) on the left and Dual Graph (from StreetContinuity) on the right.