Пример #1
0
 private void getPointFromAddress(String formattedAddress)
 {
     GeocodeRequest geocodeRequest = new GeocodeRequest()
     {
         Credentials = new Credentials() { ApplicationId = BingMapKey },
         Query = formattedAddress,
         Options = new GeocodeOptions() {Count = 1 }
     };
     GeocodeService.GeocodeServiceClient geocodeService = new GeocodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
     try
     {
         geocodeService.GeocodeAsync(geocodeRequest);
         geocodeService.GeocodeCompleted += geocodeService_GeocodeCompleted;
     }
     catch (EndpointNotFoundException e)
     {
         geocodeService.Abort();
     }
 }
Пример #2
0
 private void getAddressFromPoint(double latitude, double longitude)
 {
     ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest()
     {
         Credentials = new Credentials() { ApplicationId = BingMapKey },
         Location = new Location() { Latitude = latitude, Longitude = longitude }
     };
     GeocodeService.GeocodeServiceClient geocodeService = new GeocodeService.GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
     try
     {
         geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
         geocodeService.ReverseGeocodeCompleted += geocodeService_ReverseGeocodeCompleted;
     }
     catch (EndpointNotFoundException e)
     {
         geocodeService.Abort();
     }
 }