Finding an address by latitude and longitude

6

Since I can get the full address of a geolocation, ex:

Lat. 37.386196601958
Lon. -121.964346639

(Such a street, Such a neighborhood, cep: tal)

    
asked by anonymous 13.02.2016 / 20:07

2 answers

5

Use the Google-supplied API :

https://maps.googleapis.com/maps/api/geocode/output?parameters

The output defines the response format, which can be JSON or XML. %% Depends on the type of information you're looking for, more details can be found in documentation . A simple search for latitude and longitude could be done as follows:

http://maps.googleapis.com/maps/api/geocode/json?latlng=37.386196601958,-121.964346639
    
13.02.2016 / 20:32
1

If you want an OpenSource / Free solution, use the OpenStreet reverse service. It would look like an ajax request:

  reqwest({
      url: 'http://nominatim.openstreetmap.org/reverse?',
      method: 'get',
      crossOrigin: true,
      type: 'json',
      data: {
          format: 'json',
          lat: latitude,
          lon: longitude,
          addressdetails: 1,
          'accept-language': 'pt-BR',
          zoom: 18
      }
  }).then(function (response) {
        console.info(response);
    msg_el.innerHTML = response.display_name;
  }).fail(function (err, msg) {
      console.info(err, msg);
  });

link

    
16.02.2016 / 19:32