Web services Webservice中的Webcontrol

Web services Webservice中的Webcontrol,web-services,google-maps,web-controls,Web Services,Google Maps,Web Controls,我需要在我的Web服务中使用Webcontrol(System.Windows.Forms.WebBrowser),因为我必须计算坐标之间的距离,为此我将使用谷歌地图(geocoder)。使用Webcontrol,我可以执行javascript代码来计算距离(Webcontrol.Document.InvokeScript) 有没有办法在webservice中获得webcontrol?或者还有其他更简单的方法来完成我的任务吗?地理编码API不仅仅通过JavaScript工作。除了JavaScri

我需要在我的Web服务中使用Webcontrol(System.Windows.Forms.WebBrowser),因为我必须计算坐标之间的距离,为此我将使用谷歌地图(geocoder)。使用Webcontrol,我可以执行javascript代码来计算距离(Webcontrol.Document.InvokeScript)


有没有办法在webservice中获得webcontrol?或者还有其他更简单的方法来完成我的任务吗?

地理编码API不仅仅通过JavaScript工作。除了JavaScript,您还可以使用URL get请求请求json或xml响应。(见)例如:

http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
我是这样做的:

System.Xml.XmlDocument document = new XmlDocument();
//Request XML through Google API
document.Load("http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false");

//Parse output
XmlNodeList latNodeList = document.GetElementsByTagName("lat");
XmlNodeList lngNodeList = document.GetElementsByTagName("lng");
String lat = latNodeList.Item(0).InnerText;
String lng = lngNodeList.Item(0).InnerText;
然而,基于你想要的(计算距离),我认为谷歌距离矩阵API是你正在寻找的东西。()