Skip to content

Commit cc5c09e

Browse files
committed
Add a new strict parameter to get_nodes() function
Sometimes, the openstreetmap server is inconsistent in that way that the list of node ids of a `Way` contains nodes that actually do not exist. In that case, no nodes of a `Way` will be retrieved even if there are valid nodes. You can now set the strict_mode to False so that invalid nodes will be removed from a Way. The default behaviour still is to try to retrieve the missing nodes and if the node does not exist, a DataIncomplete exception is thrown.
1 parent 979518e commit cc5c09e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

overpy/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
__summary__ = "Python Wrapper to access the OpenStreepMap Overpass API"
1414
__uri__ = "https://github.com/DinoTools/python-overpy"
1515

16-
__version__ = "0.4"
16+
__version__ = "0.4.1"
1717

1818
__author__ = "PhiBo (DinoTools)"
1919
__email__ = ""

overpy/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ def nodes(self):
913913
"""
914914
return self.get_nodes()
915915

916-
def get_nodes(self, resolve_missing=False):
916+
def get_nodes(self, resolve_missing=False, strict_mode=True):
917917
"""
918918
Get the nodes defining the geometry of the way
919919
@@ -937,11 +937,11 @@ def get_nodes(self, resolve_missing=False):
937937
result.append(node)
938938
continue
939939

940-
if not resolve_missing:
940+
if not resolve_missing and strict_mode:
941941
raise exception.DataIncomplete("Resolve missing nodes is disabled")
942942

943943
# We tried to resolve the data but some nodes are still missing
944-
if resolved:
944+
if resolved and strict_mode:
945945
raise exception.DataIncomplete("Unable to resolve all nodes")
946946

947947
query = ("\n"

0 commit comments

Comments
 (0)