如何使用C#查找经纬度 [英] How to find latitude and longitude using C#

查看:173
本文介绍了如何使用C#查找经纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中有一个WCF服务.

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.

我正计划使用Google API来实现上述功能.

I am planning to use Google API to implement above functionality.

我已经从Google获得了API密钥,并且类型为服务帐户".

I have obtained an API key from Google and its of type 'Service account'.

如何使用哪些API获取纬度和经度?

How can I obtain the latitude and longitude using which APIs?

我需要安装某些SDK还是任何REST服务都可以?

Do I need to install some SDK or any REST Service will do?

推荐答案

如果您想使用Google Maps API来查看其REST API,则无需安装Google Maps 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.

对于响应JSON:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Estância+Sergipe,&key=**YOUR_API_KEY**

有关更多信息,请参阅

https://developers.google.com/maps/documentation/geocoding /index#GeocodingRequests

这篇关于如何使用C#查找经纬度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆