Skip to content Skip to sidebar Skip to footer

Convert Latitude/longitude To Address

I need to convert a lat/long coordinates to a address. I could use the Google Maps API but I would need a XML Response. I have looked at Convert Lat Long to address Google Maps Api

Solution 1:

You can use GeoNames' FindNearestAddress.

It takes a latitude and longitude parameter and returns the nearest address in XML format.

From the example:

http://api.geonames.org/findNearestAddress?lat=37.451&lng=-122.18&username=demo

<address><street>Roble Ave</street><mtfcc>S1400</mtfcc><streetNumber>649</streetNumber><lat>37.45127</lat><lng>-122.18032</lng><distance>0.04</distance><postalcode>94025</postalcode><placename>Menlo Park</placename><adminCode2>081</adminCode2><adminName2>San Mateo</adminName2><adminCode1>CA</adminCode1><adminName1>California</adminName1><countryCode>US</countryCode></address></geonames>

Solution 2:

var geocoder  = new google.maps.Geocoder();             // create a geocoder objectvar location  = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);    // turn coordinates into an object          
geocoder.geocode({'latLng': location}, function (results, status) {
if(status == google.maps.GeocoderStatus.OK) {           // if geocode successvar add=results[0].formatted_address;         // if address found, pass to processing functiondocument.write(add);

source from https://gist.github.com/marchawkins/9406213/download# it works me

Solution 3:

this is an alternate method. U can use the following google api for getting the address as json script .You can parse the same in your application to get the address.

https://maps.googleapis.com/maps/api/directions/json?origin=27.6325&destination=85.1453=end&sensor=false

Post a Comment for "Convert Latitude/longitude To Address"