Skip to content

Commit

Permalink
Merge pull request #1 from LucasScabora
Browse files Browse the repository at this point in the history
General correction in the repository.
  • Loading branch information
gabrielspadon authored Feb 14, 2019
2 parents 18558f8 + 240b6fc commit 140d6b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,33 @@ Dependencies
* osmnx (0.8.1)
* networkx (2.1)

Instalation (for developers)
--------------

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


```bash
pip3 install . --user
```

Example
--------------

```python
import osmnx as ox
from streetcontinuity.all import *
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

p_graph = from_osmnx(oxg=oxg, use_label=True)
d_graph = dual_mapper(primal_graph=p_graph, min_angle=120)

# you must create the data directory before running this command
Expand Down
2 changes: 1 addition & 1 deletion street_continuity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
--------------
>>> import osmnx as ox
>>> from StreetContinuity.all import *
>>> from street_continuity.all import *
>>> oxg = ox.graph_from_point((-22.012282, -47.890821), distance=5000)
Expand Down
2 changes: 1 addition & 1 deletion street_continuity/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def read_csv(nodes_filename: str, edges_filename: str, directory: str, use_label

for eid, source, target, length, name, label in csv_reader:
if not has_header:
if compute_distance(source, target) > 0.0: # sanity check: self-loops are not allowed
if compute_distance(node_dictionary[source], node_dictionary[target]) > 0.0: # sanity check: self-loops are not allowed
edge_dictionary[eid] = primal_graph.Edge(eid, source, target, np.float(length),
name, label if use_label else 'unclassified')
has_header = False
Expand Down

0 comments on commit 140d6b8

Please sign in to comment.