简体   繁体   中英

Google API to get address corresponding to Latitude and Longitude in C#

I am trying to get address corresponding to latitude and longitude using Google API only in C#.

I had already it working in JavaScript with jQuery. I now have to write code in C#. Could someone please let me know the equivalent C# API?

Sounds like you want to do reverse geocoding. If you are using .net or mono, you should be use this library to easily accomplish this task: https://github.com/chadly/Geocoding.net

This is called reverse geocoding , and if you really need to do it server-side, you just have to call the Google Maps API like this :

http://maps.google.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false

This produces a result formatted in json.
Just read it in C# or VB.NET and look at the property formatted_address .

Please note NOT to add space between latitude and longitude, before or after the comma.


Pay attention to limitation and licence

As described here , there is a request limit by 24hours peridod, depending of the licence you get.

Also remember :

The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM