diff options
| -rw-r--r-- | store.py | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -13,10 +13,8 @@ class Node: return self.lat, self.lng -parser = None # Have a global reusable parser object - - -def add_neighbours(nodes): +def add_neighbours(nodes, parser): + print("adding neighbours") for way in parser.iter_ways(): if 'highway' not in way['tags']: continue @@ -34,14 +32,13 @@ def add_neighbours(nodes): def extract_osm_nodes(f_name): - global parser parser = get_default_parser(f_name) nodes = dict() for node in parser.iter_nodes(): nodes[node['id']] = Node(node['id'], node['lat'], node['lon']) - add_neighbours(nodes) + add_neighbours(nodes, parser) # remove nodes without neighbours for node_id, node in nodes.copy().items(): |
