From 0f56eb5aca4ede8c87c8b82fea52ed950724b24c Mon Sep 17 00:00:00 2001 From: Al Date: Thu, 14 Jul 2016 17:58:54 -0400 Subject: [PATCH] [fix] Only add nodes to dictionary if they have place= as there are named nodes that are not admin_centres --- scripts/geodata/osm/admin_boundaries.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/geodata/osm/admin_boundaries.py b/scripts/geodata/osm/admin_boundaries.py index 3b03e7ba..753541bd 100644 --- a/scripts/geodata/osm/admin_boundaries.py +++ b/scripts/geodata/osm/admin_boundaries.py @@ -206,7 +206,7 @@ class OSMPolygonReader(object): if isclose(lon, 180.0): lon = 179.999 - if 'name' in props: + if 'name' in props and 'place' in props: self.nodes[node_id] = props # Nodes are stored in a sorted array, coordinate indices are simply @@ -261,8 +261,8 @@ class OSMPolygonReader(object): inner_ways.append(elem_id) elif role == 'admin_centre': val = self.nodes.get(long(elem_id)) - val['id'] = long(elem_id) if val is not None: + val['id'] = long(elem_id) admin_centers.append(val) outer_polys = self.create_polygons(outer_ways)