Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/281.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用c#中的webBrowser控件获取用户google纬度和经度?_C#_.net_Google Maps Api 3_Webbrowser Control - Fatal编程技术网

如何使用c#中的webBrowser控件获取用户google纬度和经度?

如何使用c#中的webBrowser控件获取用户google纬度和经度?,c#,.net,google-maps-api-3,webbrowser-control,C#,.net,Google Maps Api 3,Webbrowser Control,我可以使用c#webrowser控件使用google javascript api v3获取纬度和经度吗?您不必使用google的任何javascript api来获取地理代码数据。只需使用WebRequest对象并从geocode服务提供的XML文件中读取结果 WebRequest req = System.Net.WebRequest.Create("your adress"); WebResponse response = req.GetResponse(); 从那里,您可以获得流并创建

我可以使用c#webrowser控件使用google javascript api v3获取纬度和经度吗?

您不必使用google的任何javascript api来获取地理代码数据。只需使用WebRequest对象并从geocode服务提供的XML文件中读取结果

WebRequest req = System.Net.WebRequest.Create("your adress");
WebResponse response = req.GetResponse();
从那里,您可以获得流并创建一个StreamReader,如下所示:

Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
之后,只需使用元素标记“lat”和“lng”对XML进行解码。 然后,您应该能够获得您正在寻找的数据


有关更多信息,尤其是使用谷歌地理编码服务的服务条款,请访问谷歌地图API网站。

我无法提供地址。我想知道没有地址的用户位置。您正在移动设备上开发应用程序吗?您可能需要查看一些GPS API或类似的东西。
            string strSelect = textBoxGpsLatitude.Text;
            strSelect += ",";
            strSelect += textBoxGpsLongitude.Text;

            webBrowser3.Navigate("http://maps.google.com/maps?q=" + strSelect, false);