I have an application in which I would like to show the name of the town or city where the location of the person using the application is, currently I have the LATITUDE and LONGITUDE . But now I don't know how to proceed.
navigator.geolocation.getCurrentPosition(function(pos) {
var position = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
}, function (error) {
// Código de error
});
Use google.maps.Geocoder
Unfortunately this documentation is in English
The way of use is as follows:
Here is a working example:
I leave you an example of Reverse Geolocation
Example taken from: https://developers.google.com/maps/documentation/javascript/examples/geocoding-reverse
Here is an example of developing a weather widget where there is a Javascript method where the city is obtained. http://marcodetrabajo.com/widget-meteorologia-jquery/
You can use the method as follows:
WeatherApi.getCityAndCountry(tuLatitud, tuLongitud)
Cheers
Good afternoon... And how would it be for when you have several markers or points...
Since I have this... I get from a DB a json with latitudes and longitudes... and I want to show it in a datatable as well as on the map with the markers... I want something like this...
---latitude: 22 | length: 33 | Geocoder address ---latitude: 23 | length: 34 | Geocoder address ---latitude: 24 | length: 35 | Geocoder Address
But at the moment of executing... only one position is shown on the map and the first data in the table... it is as if it did not go further in the geocoder part...
Where this error...??
Beforehand thank you very much..