gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 05:54:53 24 4
gpt4 key购买 nike

如何在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com