如何在 Windows Phone 中将地理坐标转换为地址? 在 Android 中,可以通过 android.location.Geocoder 实现。
最佳答案
这绝对能让你继续下去:) 还在该消息的底部摘录了该博客的内容,以便您知道这是否是您想要的内容。
获取包含地理编码 API 的 System.Device.dll。
//Instantiate
GeoCoordinateWatcher watcher = null;
watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default);
watcher.PositionChanged +=
new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(OnPositionChanged);
watcher.Start();
//Use
void OnPositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
//stop & clean up, we don’t need it anymore
watcher.Stop();
watcher.Dispose();
watcher = null;
location = e.Position.Location;
}
和地理编码:
var reverseGeocodeRequest = new ReverseGeocodeRequest();
// Set the credentials using a valid Bing Maps key
reverseGeocodeRequest.Credentials = new BingMaps.Credentials();
reverseGeocodeRequest.Credentials.ApplicationId = "ENTER YOUR BING MAPS KEY HERE";
// Set the point to use to find a matching address
BingMaps.Location point = new BingMaps.Location();
point.Latitude = location.Latitude;
point.Longitude = location.Longitude;
reverseGeocodeRequest.Location = point;
// Make the reverse geocode request
GeocodeServiceClient geocodeService = new
GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
geocodeService.ReverseGeocodeCompleted += new
EventHandler<ReverseGeocodeCompletedEventArgs>
(geocodeService_ReverseGeocodeCompleted);
geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
关于windows-phone-7 - Windows Phone API 有地理编码器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9637341/