Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Response from geocoding API

I'm able to get the fully formatted address from the api,

"1600 Amphitheatre Parkway, Mountain View, CA 94043, USA"

for example.

How do i "breaking to pieces" this formatted address(city, street, country etc)?

code for getting the fully address -

   final formattedAddress =decodedResponse['results'][0]['formatted_address']
like image 466
Michael Avatar asked Sep 21 '26 20:09

Michael


1 Answers

According to the result from the api(https://developers.google.com/maps/documentation/geocoding/intro#GeocodingResponses)

I can write decodedResponse['results'][0]['address_components'][0]['long_name']

The second [0] indicate the location of the type

like image 77
Michael Avatar answered Sep 23 '26 13:09

Michael



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!