[fix] just ignore records without the "name" tag
This commit is contained in:
@@ -506,6 +506,9 @@ class OSMAddressFormatter(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
return (), None
|
return (), None
|
||||||
|
|
||||||
|
if 'name' not in tags:
|
||||||
|
return (), None
|
||||||
|
|
||||||
osm_components = self.components.osm_reverse_geocoded_components(latitude, longitude)
|
osm_components = self.components.osm_reverse_geocoded_components(latitude, longitude)
|
||||||
|
|
||||||
country, candidate_languages = OSMCountryReverseGeocoder.country_and_languages_from_components(osm_components)
|
country, candidate_languages = OSMCountryReverseGeocoder.country_and_languages_from_components(osm_components)
|
||||||
@@ -546,7 +549,7 @@ class OSMAddressFormatter(object):
|
|||||||
for i, c in enumerate(osm_components):
|
for i, c in enumerate(osm_components):
|
||||||
c_name = osm_address_components.component_from_properties(country, c, containing=containing_ids[i + 1:])
|
c_name = osm_address_components.component_from_properties(country, c, containing=containing_ids[i + 1:])
|
||||||
|
|
||||||
if 'name' in tags and c.get('name', '').lower() == tags['name'].lower():
|
if c.get('name', '').lower() == tags['name'].lower():
|
||||||
same_name_components[i] = c_name
|
same_name_components[i] = c_name
|
||||||
|
|
||||||
if first_valid_admin_center is None:
|
if first_valid_admin_center is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user