Commit 21fd34e7 authored by Rick Gruber-Riemer's avatar Rick Gruber-Riemer

Taking into account situation, where a reference in a Way is missing in OSM nodes

parent b4fd4d9a
......@@ -41,8 +41,11 @@ class Pier(object):
self.is_area = 'area' in tags
self.elevation = 0
self.osm_nodes = [nodes_dict[r] for r in refs]
self.nodes = np.array([transform.toLocal((n.lon, n.lat)) for n in self.osm_nodes])
self.osm_nodes = list()
for r in refs: # safe way instead of [nodes_dict[r] for r in refs] if ref would be missing
if r in nodes_dict:
self.osm_nodes.append(nodes_dict[r])
self.nodes = np.array([transform.toLocal((n.lon, n.lat)) for n in self.osm_nodes])
self.anchor = vec2d(self.nodes[0])
def calc_elevation(self, elev_interpolator):
......
......@@ -43,7 +43,10 @@ class Platform(object):
if 'layer' in tags:
self.logger.warn("layer %s %d", tags['layer'], osm_id)
self.osm_nodes = [nodes_dict[r] for r in refs]
self.osm_nodes = list()
for r in refs: # safe way instead of [nodes_dict[r] for r in refs] if ref would be missing
if r in nodes_dict:
self.osm_nodes.append(nodes_dict[r])
self.nodes = np.array([transform.toLocal((n.lon, n.lat)) for n in self.osm_nodes])
# self.nodes = np.array([(n.lon, n.lat) for n in osm_nodes])
self.line_string = shg.LineString(self.nodes)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment