Better Google geocoding through concatenation

This commit is contained in:
Juan Ignacio Sánchez Lara
2018-06-27 13:47:57 +02:00
parent a931086e29
commit d0b04a97b8

View File

@@ -61,6 +61,8 @@ class GoogleMapsGeocoder:
search_id, address, city, state, country = \
[search.get(k, None) for k in self.SEARCH_KEYS]
opt_params = self._build_optional_parameters(city, state, country)
# Geocoding works better if components are also inside the address
address = ', '.join(filter(None, [address, city, state, country]))
if address:
self._logger.debug('async geocoding --> {} {}'.format(address.encode('utf-8'), opt_params))
result = pool.apply_async(async_geocoder,