Add support for town when resolving location name #386 (#387)

This commit is contained in:
Jaisen Mathai 2020-10-23 00:48:19 -07:00 committed by GitHub
parent ed4b58aa0d
commit df7ceeec87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -162,7 +162,9 @@ def place_name(lat, lon):
geolocation_info = lookup(lat=lat, lon=lon)
if(geolocation_info is not None and 'address' in geolocation_info):
address = geolocation_info['address']
for loc in ['city', 'state', 'country']:
# gh-386 adds support for town
# taking precedence after city for backwards compatability
for loc in ['city', 'town', 'state', 'country']:
if(loc in address):
lookup_place_name[loc] = address[loc]
# In many cases the desired key is not available so we