Is there a way to get a city name from a latitude and longitude point using the google maps api for javascript?
If so could I please see an example?
You can use https://ip-api.io/ to get city Name.
To search for a place, enter the latitude and longitude GPS coordinates on Google Maps. You can also find the coordinates of the places you previously found. Besides longitude and latitude, you can use plus codes to share a place without an address.
This is called Reverse Geocoding
Documentation from Google:
http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding.
Sample Call to Google's geocode Web Service:
http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=true&key=YOUR_KEY
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With