none
Bing map get address by latlong(reverse geocode service) RRS feed

  • Question

  •  am using reverse geocode service to find out the address, but the location and credential keep display error(the type or namespace doesn't exist)

    below is the code i am using (me already add the GeocodeService web service reference)

    highlight text is where my error is!!

    private void btnQueryReverse_Click(object sender, RoutedEventArgs e)
         {


            

    ReverseGeocodeRequest reverseGeocodeRequest = new ReverseGeocodeRequest();
    reverseGeocodeRequest.Credentials = new Microsoft.Maps.MapControl.Credentials();
    // Set the credentials using a valid Bing Maps key
    reverseGeocodeRequest.Credentials = new GeocodeService.Credentials();
    reverseGeocodeRequest.Credentials.ApplicationId = "key"

    // Set the point to use to find a matching address
    GeocodeService.Location point = new GeocodeService.Location();
    point.Latitude = 47.6412;
    point.Longitude = -122.130609;

    reverseGeocodeRequest.Location = point;

    // Make the reverse geocode request
    GeocodeServiceClient geocodeService = new GeocodeServiceClient("BasicHttpBinding_IGeocodeService");
    geocodeService.ReverseGeocodeCompleted += new EventHandler<ReverseGeocodeCompletedEventArgs>(geocodeService_ReverseGeocodeCompleted);
    geocodeService.ReverseGeocodeAsync(reverseGeocodeRequest);
    }
            void geocodeService_ReverseGeocodeCompleted(object sender, ReverseGeocodeCompletedEventArgs e)
            {
                // The result is a GeocodeResponse object
                GeocodeResponse geocodeResponse = e.Result;

                if (geocodeResponse.Results.Length>0)
                    tbLongitude.Text = geocodeResponse.Results[0].DisplayName;
                else
                    tbLongitude.Text = "No Results found";
            }

    • Moved by Ricky_Brundritt Friday, March 9, 2012 5:02 PM (From:Bing Maps: Map Control and Web services Development)
    Tuesday, April 12, 2011 3:25 AM

Answers

All replies