2012-03-09 6 views

ответ

3

Это должно определенно получить вас :) Также сделал выписку из этого блога на botton этого сообщения, чтобы вы знали, если это то, что вы ищете.

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


Get System.Device.dll который держит геокодирования API.

//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; 
} 

И GeoCoding:

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);