summaryrefslogtreecommitdiffstats
path: root/store.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2020-12-16 07:04:00 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2020-12-16 07:04:00 +0100
commit90cba31d48974f1b7f694e570f8732098359a5ea (patch)
tree8c7a8222d368675fc580497877b57dbd257e4237 /store.py
parent6c8acb4f4eabb20da41b941158bf52038035699f (diff)
parente15617848b6837216a8ceed4ca23b3bb415a42f7 (diff)
downloadtdde25-90cba31d48974f1b7f694e570f8732098359a5ea.tar.gz
Merge remote-tracking branch 'origin/xml-iterparse'
Diffstat (limited to 'store.py')
-rw-r--r--store.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/store.py b/store.py
index c988e47..87cd940 100644
--- a/store.py
+++ b/store.py
@@ -42,10 +42,7 @@ class Node:
return self.lat, self.lng
-parser = None # Have a global reusable parser object
-
-
-def add_neighbours(nodes):
+def add_neighbours(nodes, parser):
for way in parser.iter_ways():
if 'highway' not in way['tags']:
continue
@@ -65,7 +62,6 @@ def add_neighbours(nodes):
def extract_osm_nodes(f_name):
- global parser
parser = get_default_parser(f_name)
nodes = dict()
grid = defaultdict()
@@ -74,7 +70,7 @@ def extract_osm_nodes(f_name):
new_node = Node(node['id'], node['lat'], node['lon'])
nodes[node['id']] = new_node
- add_neighbours(nodes)
+ add_neighbours(nodes, parser)
# Remove nodes without neighbours
for node_id, node in nodes.copy().items():