[polygons/osm] append polygon nodes by vertices that connect to each other

This commit is contained in:
Al
2016-01-16 21:20:49 -05:00
parent d4143c1685
commit 19a5541a85

View File

@@ -132,9 +132,16 @@ class OSMAdminPolygonReader(object):
for component in strongly_connected_components(way_graph):
poly_nodes = []
for way_id in component:
seen = set()
q = component[:1]
while q:
way_id = q.pop()
way_index = way_indices[way_id]
poly_nodes.extend(self.node_coordinates(self.way_coords, self.way_indptr, way_index)[:-1])
neighbors = way_graph[way_id]
q.extend([w for w in neighbors if w not in seen])
seen.add(way_id)
polys.append(poly_nodes)