C# - 如何使用C#找经纬度 [英] C# - How to find latitude and longitude using C#
问题描述
我在C#中的WCF服务。
在服务调用客户端发送一个城市的名字。我想这个城市名称转换为纬度和经度,并存储在数据库下人口统计数据。
我打算使用谷歌API来实现上述功能。
我已经获得谷歌的API密钥和类型的服务帐户。
所以现在我怎样才能获得使用哪些API的经纬度?
我是否需要安装一些SDK或REST服务将做什么?
I have a WCF service in C#. In the Service call client sends a city name. I want to convert the city name to latitudes and longitudes and store in Database under demographics. I am planning to use Google API to implement above functionality. I have obtained an API key from Google and its of type 'Service account'. SO now How can I obtain the the latitude and longitude using which APIs? Do I need to install some SDK or any REST Service will do?
推荐答案
如果您想使用谷歌地图API看看他们的REST API,你并不需要安装谷歌地图API只是像发送请求
If you want to use the Google Maps API have a look at their REST API, you don't need to install a Google Maps API just send a Request like
http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true_or_false
,你会得到一个XML响应。
and you will get a response XML.
有关详细信息,看一看
https://developers.google.com/maps/documentation /地理编码/指数#GeocodingRequests
这篇关于C# - 如何使用C#找经纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!