[fix] putting the neighborhoods check after the dupe threshold check, as it's not really needed until then anyway

This commit is contained in:
Al
2016-12-18 03:00:40 -05:00
parent 4314a6822d
commit e5657c5612

View File

@@ -366,8 +366,9 @@ class NeighborhoodReverseGeocoder(RTreePolygonIndex):
if arg_max: if arg_max:
ranks.append(arg_max) ranks.append(arg_max)
if not ranks: ranks.sort(key=operator.itemgetter(0), reverse=True)
continue if ranks and ranks[0][0] >= cls.DUPE_THRESHOLD:
score, props, poly, idx, i = ranks[0]
existing_osm_boundaries = osm_admin_rtree.point_in_poly(lat, lon, return_all=True) existing_osm_boundaries = osm_admin_rtree.point_in_poly(lat, lon, return_all=True)
@@ -391,10 +392,6 @@ class NeighborhoodReverseGeocoder(RTreePolygonIndex):
if skip_node: if skip_node:
continue continue
ranks.sort(key=operator.itemgetter(0), reverse=True)
if ranks and ranks[0][0] >= cls.DUPE_THRESHOLD:
score, props, poly, idx, i = ranks[0]
containing_ids = [(boundary['type'], boundary['id']) for boundary in existing_osm_boundaries] containing_ids = [(boundary['type'], boundary['id']) for boundary in existing_osm_boundaries]
component = osm_address_components.component_from_properties(country, props, containing=containing_ids) component = osm_address_components.component_from_properties(country, props, containing=containing_ids)
attrs['component'] = component attrs['component'] = component