Geocoding through Bing Maps works but WebService not returning results
When I search for this address (example: 1 Finlayson Green, Level 15 , Unit 01, , Singapore) on Bings Maps or the Virtual Earth object through JavaScript, it finds the lat lon position rightaway. But when I try to do the same through the MapPoint webservice, I'm not getting any results.
Has anyone had a similar problem? If so, can you please tell me how to fix the problem?
Here is a code snippet from my project which gets the GeoCode for a given address:
string token = GetToken();
GeocodeService.GeocodeRequest geocodeRequest = new GeocodeService.GeocodeRequest();
geocodeRequest.Credentials = new GeocodeService.Credentials();
geocodeRequest.Credentials.Token = token;
geocodeRequest.Query = strAddress; // "1 Finlayson Green, Level 15 , Unit 01, , Singapore "
// Set the options to only return high confidence results
GeocodeService.ConfidenceFilter[] filters = new GeocodeService.ConfidenceFilter[1];
filters[0] = new GeocodeService.ConfidenceFilter();
filters[0].MinimumConfidence = GeocodeService.Confidence.High;
GeocodeService.GeocodeOptions geocodeOptions = new GeocodeService.GeocodeOptions();
geocodeOptions.Filters = filters;
geocodeRequest.Options = geocodeOptions;
GeocodeService.GeocodeServiceClient geocodeService = new GeocodeService.GeocodeServiceClient();
GeocodeService.GeocodeResponse geocodeResponse = geocodeService.Geocode(geocodeRequest);
if (geocodeResponse.Results.Length > 0)
{
oRet.AddressLine = geocodeResponse.Results[0].Address.AddressLine;
oRet.AdminDistrict = geocodeResponse.Results[0].Address.AdminDistrict;
oRet.BestView = geocodeResponse.Results[0].BestView;
oRet.CountryRegion = geocodeResponse.Results[0].Address.CountryRegion;
oRet.DisplayName = geocodeResponse.Results[0].DisplayName;
oRet.District = geocodeResponse.Results[0].Address.District;
oRet.FormattedAddress = geocodeResponse.Results[0].Address.FormattedAddress;
oRet.Latitude = geocodeResponse.Results[0].Locations[0].Latitude;
oRet.Longitude = geocodeResponse.Results[0].Locations[0].Longitude;
oRet.NoExactMatch = false;
}
else
{
oRet.FormattedAddress = "No results were found for the address";
}
Thanks in advance.
Chandra Sekhar
Answers
- I've seen this before. The issue is that you have your confidence filter set to High. If you look at the VEPlace object that gets returned for that address in the AJAX control the confidence level is medium. Changing your confidence level to Medium will allow that location to be returned by the Geocoding Service.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byRichard_BrundrittMVP, ModeratorFriday, November 20, 2009 5:25 AM
- Is it possible that a different version is sitting on the server? Are you seeing any errors in the error logs? If your seeing connection errors it's possible that some of the connections are being blocked by your proxy or firewall.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byRichard_BrundrittMVP, ModeratorFriday, November 20, 2009 5:24 AM
All Replies
- I've seen this before. The issue is that you have your confidence filter set to High. If you look at the VEPlace object that gets returned for that address in the AJAX control the confidence level is medium. Changing your confidence level to Medium will allow that location to be returned by the Geocoding Service.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byRichard_BrundrittMVP, ModeratorFriday, November 20, 2009 5:25 AM
- I even changed the confidence level to "Low". But no effect. It still wouldn't find the addresses. Thanks.
Chandra Sekhar - My bad. Its working with confidence level LOW. Thank you very much.
Chandra Sekhar - I'm confused. The same code works fine from my local machine but wouldn't geocode from the Server. On the server, its able to geocode some addresses though.
Chandra Sekhar - Is it possible that a different version is sitting on the server? Are you seeing any errors in the error logs? If your seeing connection errors it's possible that some of the connections are being blocked by your proxy or firewall.
Windows Live Developer MVP - http://rbrundritt.spaces.live.com- Marked As Answer byRichard_BrundrittMVP, ModeratorFriday, November 20, 2009 5:24 AM

