windows-phone-7 - Windows Phone API 有地理编码器吗?

标签 windows-phone-7 reverse-geocoding

如何在 Windows Phone 中将地理坐标转换为地址? 在 Android 中,可以通过 android.location.Geocoder 实现。

最佳答案

这绝对能让你继续下去:) 还在该消息的底部摘录了该博客的内容,以便您知道这是否是您想要的内容。

http://www.dizzey.com/development/net/getting-started-windows-phone-7-getting-location-reverse-geocoding-weather/


获取包含地理编码 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/

相关文章:

windows-phone-7 - 测试移动页面 Windows Phone 7 浏览器

angular - 使用 Angular 进行反向地理编码

java - 如何获取在geocoding api android中选择的区域的周长?

C# Windows Phone 7 ListBox 向上/向下滚动事件?

c# - 获取 XElement 的名称

ios - 如何在 iOS 5 中创建位置自动完成输入字段?

google-maps-api-3 - 具有两个主键的数据结构? (缓存纬度/经度地址对)

android - 如何从Android上的地址获取经纬度?

windows-phone-7 - 学习 Windows Phone 7 编程的主要痛点是什么?

windows-phone-7 - WP7 : Get current PivotItem for data-bound Pivot