none
Critical error with geocode and reverseGeocode. Bing Maps AJAX Control v7 RRS feed

  • Question

  • Microsoft.Maps.loadModule('Microsoft.Maps.Search');
    
    
    searchManager = new Microsoft.Maps.Search.SearchManager(map);
    
    // When I try to receive address coordinates, it returns 40.642835944890976,-74.07980605959892.
    
    searchManager.geocode({ where: '102 Belmont Pl, New York', callback: function (result) {
                    if (result != null)
                    {
                        if (result.results.length > 0 && result.results[0].location) {
                            var lat = result.results[0].location.latitude;
                            var lng = result.results[0].location.longitude;
    			window.test = lat + ', ' + lng;
    			alert(lat + ', ' + lng);
                        };
                    }
                    else
                    {
                        alert("Getting of points was not successful! Please, check locations!");
                    };
                } })
    
    // But when I try to receive the address on coordinates, it returns 112 Belmont Pl, Staten Island, NY 10301, not 102!
    
    searchManager.reverseGeocode({ location: new Microsoft.Maps.Location(40.642835944890976, -74.07980605959892), callback: function (result) {
                        if (result != null)
                        {
                            alert(result.name);
                        };
                    }});


    Friday, July 6, 2012 1:39 PM

Answers

  • This is not unusual. The coordinates being returned when geocoding are extrapolated based on the the known street numbers (usually at intersections). This value may not be exactly on the roof of the address in question. Bing Maps does have rooftop coordinates for a large number of locations in the US, but this address is not one of them. Using these coordinates in the reverse geocoder returns the closest known address to those coordinates which is house number 112. As there is a margin of error in both the geocoder and the reverse geocoder as the exact location is not known, only approximated locations it is not unusally that the returned address from the reverse geocoder does not match the address that was geocoded. This is a common issue in a lot mapping services.

    http://rbrundritt.wordpress.com

    Friday, July 6, 2012 3:49 PM

All replies

  • This is not unusual. The coordinates being returned when geocoding are extrapolated based on the the known street numbers (usually at intersections). This value may not be exactly on the roof of the address in question. Bing Maps does have rooftop coordinates for a large number of locations in the US, but this address is not one of them. Using these coordinates in the reverse geocoder returns the closest known address to those coordinates which is house number 112. As there is a margin of error in both the geocoder and the reverse geocoder as the exact location is not known, only approximated locations it is not unusally that the returned address from the reverse geocoder does not match the address that was geocoded. This is a common issue in a lot mapping services.

    http://rbrundritt.wordpress.com

    Friday, July 6, 2012 3:49 PM
  • Can you please explain why when entering the above coordinates (40.642835944890976,-74.07980605959892) in Bing Maps in a browser it does return the correct location the same as when entering the actull address (102 Belmont Pl, New York). However, when trying to reverseGeocode the same coordinates it returns the wrong address. Is there any difference in platforms used to query?
    Monday, July 16, 2012 6:34 PM
  • If you pass those coordinates into Bing Maps on the browser it doesn't return an address it centers the map on those coordinates. As I evplained before this all comes down to the margin of error in the extrapolated coordinates. This is very common. At best to you can gaurentee in 99% of instances where you reverse geocode a geocoded coordinate you will be able to get the same street every time. The system wasn't designed to work the way you are expectign and you would be hard pressed to find a system out there data does do what you are expecting.

    http://rbrundritt.wordpress.com

    Tuesday, July 17, 2012 8:54 AM