none
Geocode issues RRS feed

  • Question

  • I have random lat and lons being returned when I try to geocode:

     

     GeocodeRequest geocodeRequest = new GeocodeRequest();
    
                geocodeRequest.Credentials = new Microsoft.Maps.MapControl.Credentials();
                geocodeRequest.Credentials.ApplicationId = Application.Current.Resources["ProviderKey"] as String;
    
                geocodeRequest.Query = string.Format("{0}, {1}, {2} {3}", AddressValue, CityValue, ParsedState.name, ZipCodeValue);
    
                ConfidenceFilter[] filters = new ConfidenceFilter[1];
                filters[0] = new ConfidenceFilter();
                filters[0].MinimumConfidence = GeocodeService.Confidence.High;
    
                GeocodeOptions geocodeOptions = new GeocodeOptions();
                geocodeRequest.Options = geocodeOptions;
    
                geocodeService.GeocodeAsync(geocodeRequest);
    

    private void geocodeService_GeocodeCompleted(object sender, GeocodeCompletedEventArgs e)
            {
    // some error checking stuff
                    Lat = e.Result.Results[0].Locations[0].Latitude;
                    Lon = e.Result.Results[0].Locations[0].Longitude;
            }
    

    I get stuff in the middle of the ocean. I tried many different confidence filters. I am hoping someone can swoop in and call me stupid for a simple mistake.

    Thanks in advance.

    • Moved by Ricky_Brundritt Saturday, March 10, 2012 11:22 AM (From:Bing Maps: Map Control and Web services Development)
    Friday, October 7, 2011 5:29 PM

Answers

  • Can you give some examples of addresses that return the middle of the ocean? Usually when this happens it's because the address can't be found and returns 0,0 on the earth.

    Also, your filter isn't being submitted as part of the geocode request. Not a big deal because the confidence filter defaults to High anyway.

    Tuesday, October 11, 2011 2:19 PM

All replies

  • Can you give some examples of addresses that return the middle of the ocean? Usually when this happens it's because the address can't be found and returns 0,0 on the earth.

    Also, your filter isn't being submitted as part of the geocode request. Not a big deal because the confidence filter defaults to High anyway.

    Tuesday, October 11, 2011 2:19 PM
  • This is the query string:
    "1118 7th St, Gretna, Louisiana 70053"
    Results in:
    "12.356127, 51.509745"
    I may have slept through one to many geograph classes, but I'm pretty sure Louisiana isn't near Somalia:
    http://www.bing.com/maps/?v=2&cp=12.35613341774554~51.50974500000001&lvl=7&dir=0&sty=h&where1=12.356127%2C%2051.509745&form=LMLTCC
    Thursday, October 13, 2011 2:55 PM
  • Ok, after applying the filter:

     

     ConfidenceFilter[] filters = new ConfidenceFilter[1];
                filters[0] = new ConfidenceFilter();
                filters[0].MinimumConfidence = GeocodeService.Confidence.High;
    
                GeocodeOptions geocodeOptions = new GeocodeOptions();
                geocodeRequest.Options = geocodeOptions;
               geocodeOptions.Filters = new ObservableCollection<FilterBase>(filters);
    
                geocodeService.GeocodeAsync(geocodeRequest);
    

    It seems to geocode correctly. Thanks.
    • Edited by Ardune Thursday, October 13, 2011 3:12 PM
    Thursday, October 13, 2011 3:11 PM