Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get street name with Reverse Geocoding

I am trying to get Street, City and Country with reverse geocoding using google map example https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse, But all it gives me is .formatted_address not street, city and country.

Is there any way where I can get Street, City and Country separately ?

FIDDLE

like image 510
Danish Adeel Avatar asked Mar 16 '26 19:03

Danish Adeel


1 Answers

Use .address_components instead of .formatted_address, through Address Components you can break the result into different variables and then call it into your info window. Fiddle Link

like image 134
JunaidFarooqui Avatar answered Mar 18 '26 07:03

JunaidFarooqui



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!