forked from platypush/platypush
Build the address as street + street_number if they are both available
This commit is contained in:
parent
6c0dc9a4dc
commit
21ac8d7899
1 changed files with 6 additions and 2 deletions
|
@ -35,14 +35,18 @@ class GoogleMapsPlugin(GooglePlugin):
|
||||||
if component_type == 'street_number':
|
if component_type == 'street_number':
|
||||||
address['street_number'] = addr_component['long_name']
|
address['street_number'] = addr_component['long_name']
|
||||||
elif component_type == 'route':
|
elif component_type == 'route':
|
||||||
address['street'] = addr_component['long_name']
|
address['address'] = addr_component['long_name']
|
||||||
elif component_type == 'locality':
|
elif component_type == 'locality':
|
||||||
address['locality'] = addr_component['long_name']
|
address['locality'] = addr_component['long_name']
|
||||||
elif component_type == 'country':
|
elif component_type == 'country':
|
||||||
address['country'] = addr_component['short_name']
|
address['country'] = addr_component['short_name'].lower()
|
||||||
elif component_type == 'postal_code':
|
elif component_type == 'postal_code':
|
||||||
address['postal_code'] = addr_component['long_name']
|
address['postal_code'] = addr_component['long_name']
|
||||||
|
|
||||||
|
if 'address' in address and 'street_number' in address:
|
||||||
|
address['address'] += ' ' + address['street_number']
|
||||||
|
del(address['street_number'])
|
||||||
|
|
||||||
return Response(output=address)
|
return Response(output=address)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue