From c77e36deab4f787eb1ceaca774701b7072f76939 Mon Sep 17 00:00:00 2001 From: Al Date: Sat, 1 Oct 2016 00:38:13 -0400 Subject: [PATCH] [osm] Prevent user-defined lat/lon keys from overriding the lat/lon on the node --- scripts/geodata/osm/extract.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/geodata/osm/extract.py b/scripts/geodata/osm/extract.py index 64f1d77e..3db9210f 100644 --- a/scripts/geodata/osm/extract.py +++ b/scripts/geodata/osm/extract.py @@ -75,11 +75,15 @@ def parse_osm(filename, allowed_types=ALL_OSM_TAGS, dependencies=False): if item_type in allowed_types: attrs = OrderedDict(elem.attrib) + top_level_attrs = set(attrs) deps = [] if dependencies else None for e in elem.getchildren(): if e.tag == 'tag': - attrs[e.attrib['k']] = e.attrib['v'] + # Prevent user-defined lat/lon keys from overriding the lat/lon on the node + key = e.attrib['k'] + if key not in top_level_attrs: + attrs[key] = e.attrib['v'] elif dependencies and item_type == 'way' and e.tag == 'nd': deps.append(long(e.attrib['ref'])) elif dependencies and item_type == 'relation' and e.tag == 'member' and 'role' in e.attrib: