Skip to content
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

Fix is_switch by also checking the graph degree #60

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion orm_importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def run(self, polygon):
# Only nodes with max 1 edge or that are a switch can be top nodes
for node_id in self.graph.nodes:
node = self.node_data[node_id]
if is_end_node(node, self.graph) or is_switch(node):
if is_end_node(node, self.graph) or is_switch(node, self.graph):
self.top_nodes.append(node)

for node in self.top_nodes:
Expand Down
4 changes: 2 additions & 2 deletions orm_importer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def is_signal(node):
return "railway:signal:direction" in node.tags.keys()


def is_switch(node):
return is_x(node, "switch")
def is_switch(node, graph):
return is_x(node, "switch") and graph.degree(node.id) == 3


def is_x(node, x: str):
Expand Down
Loading