-
Notifications
You must be signed in to change notification settings - Fork 4
Enhance OSM getter script #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| or graph.in_degree(node) > 2 | ||
| ): | ||
| continue | ||
| u, v = neighbours |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style Warning
| or graph.in_degree(node) > 2 | ||
| ): | ||
| continue | ||
| u, v = neighbours |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "v" doesn't conform to snake_case naming style Warning
|
|
||
|
|
||
| def merge_edges( | ||
| graph: nx.DiGraph, previous_node: int, successive_node: int, node: int |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| data_u.setdefault("lanes", 1) | ||
| data_v.setdefault("lanes", 1) | ||
| if ( | ||
| not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| data_v.setdefault("lanes", 1) | ||
| if ( | ||
| not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) | ||
| or data_u["lanes"] != data_v["lanes"] |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| # define neighborus as list of predecessors and successors | ||
| neighbours = list(graph.predecessors(node)) + list(graph.successors(node)) | ||
| if ( | ||
| len(neighbours) != 2 |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| neighbours = list(graph.predecessors(node)) + list(graph.successors(node)) | ||
| if ( | ||
| len(neighbours) != 2 | ||
| or graph.in_degree(node) != graph.out_degree(node) |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| if ( | ||
| len(neighbours) != 2 | ||
| or graph.in_degree(node) != graph.out_degree(node) | ||
| or graph.in_degree(node) > 2 |
Check warning
Code scanning / Pylint (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). Warning
| or graph.in_degree(node) > 2 | ||
| ): | ||
| continue | ||
| u, v = neighbours |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "v" doesn't conform to snake_case naming style Warning
| or graph.in_degree(node) > 2 | ||
| ): | ||
| continue | ||
| u, v = neighbours |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style Warning
|
|
||
| gdf_nodes, gdf_edges = ox.graph_to_gdfs(G) | ||
| # Plot resulting graph | ||
| fig, ax = ox.plot_graph(G, show=False, close=False) |
Check warning
Code scanning / Pylint (reported by Codacy)
Constant name "fig" doesn't conform to UPPER_CASE naming style Warning
|
|
||
| gdf_nodes, gdf_edges = ox.graph_to_gdfs(G) | ||
| # Plot resulting graph | ||
| fig, ax = ox.plot_graph(G, show=False, close=False) |
Check warning
Code scanning / Pylint (reported by Codacy)
Constant name "ax" doesn't conform to UPPER_CASE naming style Warning
| import networkx as nx | ||
| import matplotlib.patches as mpatches | ||
| import matplotlib.pyplot as plt | ||
| import pandas as pd |
Check warning
Code scanning / Prospector (reported by Codacy)
Unable to import 'pandas' (import-error) Warning
| import matplotlib.patches as mpatches | ||
| import matplotlib.pyplot as plt | ||
| import pandas as pd | ||
| from shapely.geometry import MultiLineString, LineString |
Check warning
Code scanning / Prospector (reported by Codacy)
Unable to import 'shapely.geometry' (import-error) Warning
| import matplotlib.pyplot as plt | ||
| import pandas as pd | ||
| from shapely.geometry import MultiLineString, LineString | ||
| from shapely.ops import linemerge |
Check warning
Code scanning / Prospector (reported by Codacy)
Unable to import 'shapely.ops' (import-error) Warning
|
|
||
|
|
||
| def merge_edges( | ||
| graph: nx.DiGraph, previous_node: int, successive_node: int, node: int |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). graph: nx.DiGraph, previous_node: int, successive_node: int, node: int ^ | (bad-continuation) Warning
graph: nx.DiGraph, previous_node: int, successive_node: int, node: int
^ | (bad-continuation)
| data_u.setdefault("lanes", 1) | ||
| data_v.setdefault("lanes", 1) | ||
| if ( | ||
| not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) ^ | (bad-continuation) Warning
not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"])
^ | (bad-continuation)
| data_v.setdefault("lanes", 1) | ||
| if ( | ||
| not (data_u["name"] in data_v["name"] or data_v["name"] in data_u["name"]) | ||
| or data_u["lanes"] != data_v["lanes"] |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). or data_u["lanes"] != data_v["lanes"] ^ | (bad-continuation) Warning
or data_u["lanes"] != data_v["lanes"]
^ | (bad-continuation)
| # define neighborus as list of predecessors and successors | ||
| neighbours = list(graph.predecessors(node)) + list(graph.successors(node)) | ||
| if ( | ||
| len(neighbours) != 2 |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). len(neighbours) != 2 ^ | (bad-continuation) Warning
len(neighbours) != 2
^ | (bad-continuation)
| neighbours = list(graph.predecessors(node)) + list(graph.successors(node)) | ||
| if ( | ||
| len(neighbours) != 2 | ||
| or graph.in_degree(node) != graph.out_degree(node) |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). or graph.in_degree(node) != graph.out_degree(node) ^ | (bad-continuation) Warning
or graph.in_degree(node) != graph.out_degree(node)
^ | (bad-continuation)
| if ( | ||
| len(neighbours) != 2 | ||
| or graph.in_degree(node) != graph.out_degree(node) | ||
| or graph.in_degree(node) > 2 |
Check warning
Code scanning / Prospector (reported by Codacy)
Wrong hanging indentation before block (add 4 spaces). or graph.in_degree(node) > 2 ^ | (bad-continuation) Warning
or graph.in_degree(node) > 2
^ | (bad-continuation)
| or graph.in_degree(node) > 2 | ||
| ): | ||
| continue | ||
| u, v = neighbours |
Check warning
Code scanning / Prospector (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style (invalid-name) Warning
| coords = [] | ||
| for line in edge_uv["geometry"]: | ||
| coords.extend( | ||
| list(line.coords) |
Check warning
Code scanning / Pylint (reported by Codacy)
Constant name "gdf_nodes" doesn't conform to UPPER_CASE naming style Warning
| coords = [] | ||
| for line in edge_uv["geometry"]: | ||
| coords.extend( | ||
| list(line.coords) |
Check warning
Code scanning / Pylint (reported by Codacy)
Constant name "gdf_edges" doesn't conform to UPPER_CASE naming style Warning
| len(G.edges), | ||
| ) | ||
| # assert that graph has not isolated nodes | ||
| assert not list(nx.isolates(G)) |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note
| # assert that graph has not isolated nodes | ||
| assert not list(nx.isolates(G)) | ||
| # assert that graph has not self-loops | ||
| assert not list(nx.selfloop_edges(G)) |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note
| gdf_edges.reset_index(inplace=True) | ||
|
|
||
| # assert that there are no edges with the same u and v | ||
| assert not gdf_edges.duplicated(subset=["u", "v"]).any() |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note
| edges_to_remove = [] | ||
| seen_edges = {} | ||
|
|
||
| for u, v, data in graph.edges(data=True): |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "v" doesn't conform to snake_case naming style Warning
| edges_to_remove = [] | ||
| seen_edges = {} | ||
|
|
||
| for u, v, data in graph.edges(data=True): |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style Warning
| edges_to_remove = [] | ||
| seen_edges = {} | ||
|
|
||
| for u, v, data in graph.edges(data=True): |
Check warning
Code scanning / Prospector (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style (invalid-name) Warning
| edges_to_remove = [] | ||
| seen_edges = {} | ||
|
|
||
| for u, v, data in graph.edges(data=True): |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "v" doesn't conform to snake_case naming style Warning
| edges_to_remove = [] | ||
| seen_edges = {} | ||
|
|
||
| for u, v, data in graph.edges(data=True): |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "u" doesn't conform to snake_case naming style Warning
No description provided.