高德 地址编码,转为经纬度

  using (var httpClient = new HttpClient())
            {
                var key = "高德地图key";
                var address = "莫比";

                var str = string.Format("https://restapi.amap.com/v3/geocode/geo?key={0}&address={1}&batch=false", key, address);
                var url = new Uri(str);
                var response = httpClient.GetAsync(url).Result;
                var data = response.Content.ReadAsStringAsync().Result;

                dynamic jsonData = JsonConvert.DeserializeObject(data);//转为json
                var geocodes = jsonData.geocodes; //定位
                var status = jsonData.status.Value;//状态
                var count = jsonData.count.Value;//数量
                var location = geocodes[0].location;//金纬度
            }

  

上一篇:基于httpclient与jsoup的抓取当当图书页面数据简单Demo


下一篇:httpclient源码分析之 PoolingHttpClientConnectionManager 获取连接 (转)