Permalink
Browse files

Ignore missing elements when trying to join ways

Sometimes the API returns an element which is missing - the
code marks such a way as missing, but it will still be
passed to join_way_soup.  Ignore such elements.
  • Loading branch information...
1 parent 55770b9 commit c59f863051dd16387754fb4efe8ecd102c5eea24 @mhl mhl committed Nov 8, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 bin/boundaries.py
View
@@ -2039,6 +2039,11 @@ def join_way_soup(ways):
>>> result
[Way(id="None", nodes=5)]
+ If the way soup includes any missing ways, then just ignore them:
+ >>> missing = OSMElement.make_missing_element('way', '7')
+ >>> join_way_soup([w, ne, s, missing])
+ [Way(id="None", nodes=5)]
+
The nodes in the joined way should be the same as all the corners
of the square (with one repeated once to join up again):
@@ -2076,6 +2081,8 @@ def join_way_soup(ways):
closed_ways = []
endpoints_to_ways = EndpointToWayMap()
for way in ways:
+ if way.element_content_missing:
+ continue
if way.closed():
closed_ways.append(way)
continue

0 comments on commit c59f863

Please sign in to comment.