Write address by coordinates and pick up google maps

Asked

Viewed 257 times

1

I know google provides its api for maps. I would like to record addresses but also the coordinates, that when the user read these coordinates, already showed on his screen or in his App, the map of the searched address. How do I get the coordinates from a given address? Type:

Av. Nossa Senhora de Copacabana, 256 - Cep: xx.xxx-999

That’s just a random address, just an example.

1 answer

3

What you want to do is use Geocoding. The way to use will depend on the language you choose. As unspecified, follow a basic example in JS.

var geocoder = new google.maps.Geocoder();
geocoder.geocode({
    "address": inputAddress
}, function(results) {
    console.log(results[0].geometry.location); //LatLng
});

If you use . NET, I suggest you take a look at this bundle that brings enough functions in a practical way.

It is worth noting that geocoding is limited to 2500 requests per day and that according to the terms of use, you should always use it together with Google Maps.

  • I didn’t specify because it is something very generic, but today I use c# and Xamarin and Xamarin.Forms

Browser other questions tagged

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