Skip to content

StreetContinuity (SC) is a python library that able to map a Primal Graph to a Dual Graph.

License

Notifications You must be signed in to change notification settings

gabrielspadon/StreetContinuity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreetContinuity (SC)

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:

Acknowledgement

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:

Dependencies

  • numpy (1.15.4)
  • osmnx (0.8.1)
  • networkx (2.1)

Instalation (for developers)

After downloading the SC library, install it on Python 3 using the following commands:

pip3 install . --user

Example

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')

Result

This is the resulting graph using Gephi (0.9.2) and OpenOrd layout with default parameters:

Primal and Dual Graph

Primal Graph (from OSMNX) on the left and Dual Graph (from StreetContinuity) on the right.

About

StreetContinuity (SC) is a python library that able to map a Primal Graph to a Dual Graph.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages