i want to get the user location information like city, area etc using html5 geolocation,i tried the below article but with that im getting latitude and longitude, i want to get the city and area information, http://www.dotnetcurry.com/ShowArticle.aspx?ID=782
Asked
Active
Viewed 1,851 times
1 Answers
0
When you have the location of the user, you'll need to do a reverse geocoding to get information about the location such as city, etc.
Have a look at the reverse geocoding API for Google Maps.
navigator.geolocation.getCurrentPosition(function(pos){
var latlng = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
geocoder.geocode({'latLng': latlng}, function(results, status) {
console.log(results);
// Analyze results and find the info you need.
});
});
Check out How to reverse geocode without Google for information about geocoding without using Google Maps.
-
can we add maps below and point out the address based on the latitute and longitude – colors bright Feb 11 '13 at 07:24
-
Do you want to display the map with the user's location? http://gazpo.com/2011/11/geolocation/ – Jørgen Feb 11 '13 at 07:27
-
yes, with user location on it as in the above url with google maps – colors bright Feb 11 '13 at 07:29