[fix] Neighborhoods reverse geocoder discriminates between OSM matched with Zetashapes and OSM matched with Quattroshapes

This commit is contained in:
Al
2015-11-30 10:59:50 -05:00
parent feab77970b
commit c8e4602d4c

View File

@@ -164,8 +164,9 @@ class NeighborhoodReverseGeocoder(RTreePolygonIndex):
source_priorities = { source_priorities = {
'zetashapes': 0, # Best names/polygons 'zetashapes': 0, # Best names/polygons
'osm': 1, # OSM names with Quattroshapes/Zetashapes polygon 'osm_zeta': 1, # OSM names matched with Zetashapes polygon
'quattroshapes': 2, # Good results in some countries/areas 'osm_quattro': 2, # OSM names matched with Quattroshapes polygon
'quattroshapes': 3, # Good results in some countries/areas
} }
level_priorities = { level_priorities = {
@@ -350,14 +351,16 @@ class NeighborhoodReverseGeocoder(RTreePolygonIndex):
if idx is zs: if idx is zs:
attrs['polygon_type'] = 'neighborhood' attrs['polygon_type'] = 'neighborhood'
source = 'osm_zeta'
else: else:
level = props.get(QuattroshapesReverseGeocoder.LEVEL, None) level = props.get(QuattroshapesReverseGeocoder.LEVEL, None)
source = 'osm_quattro'
if level == 'neighborhood': if level == 'neighborhood':
attrs['polygon_type'] = 'neighborhood' attrs['polygon_type'] = 'neighborhood'
else: else:
attrs['polygon_type'] = 'local_admin' attrs['polygon_type'] = 'local_admin'
attrs['source'] = 'osm' attrs['source'] = source
index.index_polygon(poly) index.index_polygon(poly)
index.add_polygon(poly, attrs) index.add_polygon(poly, attrs)
idx.matched[i] = True idx.matched[i] = True