Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get city name from a latitude and longitude point?

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?

like image 646
Dennis Martinez Avatar asked Jul 01 '11 13:07

Dennis Martinez


People also ask

How do I get a city name from geolocation?

You can use https://ip-api.io/ to get city Name.

Can Google Maps use latitude and longitude?

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.


1 Answers

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

like image 197
smartcaveman Avatar answered Sep 23 '22 10:09

smartcaveman