Google Maps API - Get Coordinates of address

Google Maps

Google Maps Problem Overview


I would like to convert addresses into long/lat.

Is there any way to do this without using JavaScript? Because in my case there is no need to display anything since the conversion is in the background.

Google Maps Solutions


Solution 1 - Google Maps

What you are looking for is called Geocoding.

Google provides a Geocoding Web Service which should do what you're looking for. You will be able to do geocoding on your server.

JSON Example: > http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA

XML Example: > http://maps.google.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA


Edit:

Please note that this is now a deprecated method and you must provide your own Google API key to access this data.

Solution 2 - Google Maps

Althugh you asked for Google Maps API, I suggest an open source, working, legal, free and crowdsourced API by Open street maps

>https://nominatim.openstreetmap.org/search?q=Mumbai&format=json

Here is the API documentation for reference.

Edit: It looks like there are discrepancies occasionally, at least in terms of postal codes, when compared to the Google Maps API, and the latter seems to be more accurate. This was the case when validating addresses in Canada with the Canada Post search service, however, it might be true for other countries too.

Solution 3 - Google Maps

Solution 4 - Google Maps

A Nuget solved my problem:Geocoding.Google 4.0.0. Install it so not necessary to write extra classes etc.

https://www.nuget.org/packages/Geocoding.Google/

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionn00bView Question on Stackoverflow
Solution 1 - Google MapsDaniel VassalloView Answer on Stackoverflow
Solution 2 - Google MapsxameeramirView Answer on Stackoverflow
Solution 3 - Google MapsAquarius_GirlView Answer on Stackoverflow
Solution 4 - Google MapsKevin .NETView Answer on Stackoverflow