简体   繁体   English

GMap.NET获得经度和纬度

[英]GMap.NET get longitude and latitude

First time using GMaps.NET and I'm stuck at one part. 第一次使用GMaps.NET,我陷入了困境。

I have a list of addresses that I need to get the longitude and latitude for, but I'm not sure how to go about it. 我有一个需要获取经度和纬度的地址列表,但是我不确定该如何处理。

So I need to go from "111 Test Street, Example City, Earth" to -123,55. 因此,我需要从“地球示例城市测试街111号”转到-123,55。

I tried using GMap.NET.GeocodingProvider; 我尝试使用GMap.NET.GeocodingProvider; but to no avail. 但无济于事。

Any help greatly appreciated! 任何帮助,不胜感激!

Worked it out in case anyone else has the same issue. 解决,以防其他人遇到相同的问题。

I just did a webrequest to google which gives me what I needed. 我刚刚向Google提出了一个网络请求,这给了我所需的信息。

        var request = WebRequest.Create("http://maps.googleapis.com/maps/api/geocode/json?address=" + address +" +View,+CA&sensor=true_or_false");
        var response = (HttpWebResponse)request.GetResponse();
        request.ContentType = "application/json; charset=utf-8";

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

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