2012-03-09 3 views

答えて

3

これは間違いなくあなたに行くはずです:) また、このメッセージのbottonでこのブログの抜粋を作成しました。

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); 
関連する問題