0
我已經使用下面的代碼獲取了C#.Net中的經度和緯度。但在某些情況下,它提供了錯誤的經度/緯度。例如,如果我搜索「BraåsskolaVäxjöSweden」,它提供了[56.879004,14.805852],這是韋克舍的緯度/經度不是我們搜索的!那麼我們如何解決這個問題才能得到精確的緯度/經度。這個問題發生在很多情況下,比如「Braåsförskola44:一個VÄJJÖ」,「BjörkensförskolaVÄJJÖ」。Google Maps API網絡服務不提供準確的緯度經度
private const String _googleUri = "http://maps.google.com/maps/geo?q=";
private const String _googleKey = "yourkey";
private const String _outputType = "csv";
private static Uri GetGeocodeUri(String address) {
address = HttpUtility.UrlEncode(address);
return new Uri(String.Format("{0}{1}&output={2}&key={3}", _googleUri,
address, _outputType, _googleKey));
}
public static Coordinate GetCoordinates(String address) {
WebClient client = new WebClient();
Uri uri = GetGeocodeUri(address);
String[] geocodeInfo = client.DownloadString(uri).Split(',');
return new Coordinate(Convert.ToDecimal(geocodeInfo[2]), Convert.ToDecimal(geocodeInfo[3]));
}
請幫我找個更好的解決方案。
但是,在地理編碼中,服務每日限制非常低1000而不是2500! – Surinder 2012-07-24 09:30:12
也許吧,但是你想要的東西是一個地方,而不是一個地點。 – 2012-07-24 09:32:43