根据地址获取经度和纬度
2011-10-10 13:59
260 查看
/// <summary> /// 根据地址获取经度和纬度 /// </summary> public string GetlatlngByAddress(string address) { string result = string.Empty; try { address = HttpUtility.UrlEncode(address, Encoding.UTF8); result = GetWebContent("http://maps.google.com/maps/geo?q=" + address + "&output=xml&sensor=true&key=dc27b1d958ee7725aa1b6899af7b50816258da9bf3ffa0f736db1bf3ca24877b7a25104e7f587e1c"); XmlDocument xml = new XmlDocument(); xml.LoadXml(result); XmlNamespaceManager xmlns = new XmlNamespaceManager(xml.NameTable); xmlns.AddNamespace("e", "http://earth.google.com/kml/2.0"); result = xml.SelectSingleNode("e:kml/e:Response/e:Placemark/e:Point/e:coordinates", xmlns).InnerText; } catch { result = null; } return result; }
PS:需要引用System.Web.dll
相关文章推荐
- Android百度地图——根据城市名,地址名获取GPS纬度、经度值
- 凨-百度地图API之地图标注(JS版),地理位置信息,根据地址获取经度纬度
- 根据地址获取经度纬度
- 根据地址获取经度纬度
- 百度地图根据地址返回经度纬度 php
- 百度地图API调用(php 版本)输入地址 获取经度纬度
- 通过经度、纬度获取地址名称[JS实现]
- 腾讯地图获取地址的经度和纬度
- 百度地图获取地址信息由纬度和经度
- 开发你的LBS应用,使用Google地图引擎,根据地理位置获取纬度、经度。
- iOS. 原生获取当前经度 纬度。 地址
- ASP.NET实现根据IP获取省市地址的方法
- 通过浏览器geolocation属性获取经度和纬度(1)
- html5移动端根据百度地图api获取详细地址
- google根据地址获取经纬度
- 根据2个经纬度点,计算这2个经纬度点之间的距离(通过经度纬度得到距离)
- 高德地图-根据经纬度获取地址(逆地理编码)
- 求助!!!百度地图api可以根据地址获取到经纬度吗
- Android LocationManager获取经度与纬度等地理信息
- 根据Flickr的分享Url获取图片地址