简体   繁体   English

Google API获取与C#中的纬度和经度相对应的地址

[英]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#. 我试图仅在C#中使用Google API获取与纬度和经度相对应的地址。

I had already it working in JavaScript with jQuery. 我已经在jQuery中使用JavaScript了。 I now have to write code in C#. 我现在必须用C#编写代码。 Could someone please let me know the equivalent C# API? 有人可以让我知道等效的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 如果您使用的是.net或mono,则应使用此库轻松完成此任务: 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 : 这称为反向地理编码 ,如果您确实需要在服务器端进行此操作,则只需调用Google Maps API,如下所示:

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

This produces a result formatted in json. 这将产生以json格式格式化的结果。
Just read it in C# or VB.NET and look at the property formatted_address . 只需在C#或VB.NET中阅读它,然后查看属性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. 如上所述这里 ,有一个由24小时peridod的要求限制,这取决于你拿到驾照的。

Also remember : 还记得:

The Geocoding API may only be used in conjunction with a Google map; 地理编码API只能与Google地图结合使用; 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 . 有关允许的用法的完整详细信息,请参阅Maps API服务条款许可限制

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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