Location and maps

Asked

Viewed 855 times

0

Hello, I will work on an application that I will have to work with localization and maps, basically the user will inform an address and will appear to him nearby locations, so I wanted to know +- the path of the stones for this, I was thinking of using Asp.net mvc and EPH, I have heard that maybe for this it is better to work with the Mongodb instead of EPH.

I’ve also been thinking about using Google maps, to locate the locations nearby would be +- similar to those bank apps that you inform your zip code or the application picks up your location and shows the nearest agencies, then I will have to search in the bank the nearest registered places and order them, I thought to have an attribute for latitude and longitude, but how will I get and how will I know to know which are the closest... there is some API espcífica for this.

  • Please make intuitive and descriptive titles. Try to be more objective when describing the problem. There are a number of doubts in the middle of the main doubt, this complicates to answer and makes the question very broad.

1 answer

3


There is the Google Maps API performing latitude and longitude search from an address provided as a source of search.

Example:

<script>
   geocoder = new google.maps.Geocoder();

  function codeAddress() {
    // Aqui a API pega o valor de um endereço fornecido num campo chamado 'endereco' em tela.
    var endereco = document.getElementById("endereco").value;

    geocoder.geocode( { 'address': endereco}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        // Aqui o resultado é devolvido dentro do canvas do Google Maps.
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode falhou pelo seguinte motivo: " + status);
      }
    });
  }
</script>

If you need to have a database of latitudes and longitudes, a free alternative is the basis of Geonames, that has not only for Brazil, but for several countries in the world.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.