0
votes

I have a problem with bing map geocoding API. The API is not reliable. The same query will not always return the same result.

This query http://dev.virtualearth.net/REST/v1/Locations/?key=myKey&o=xml&countryRegion=CA&postalCode=g0a4b0

will return no address

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
<Copyright>
Copyright © 2015 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.
</Copyright>
<BrandLogoUri>
http://dev.virtualearth.net/Branding/logo_powered_by.png
</BrandLogoUri>
<StatusCode>200</StatusCode>
<StatusDescription>OK</StatusDescription>
<AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
<ResourceSets>
<ResourceSet>
<EstimatedTotal>0</EstimatedTotal>
<Resources/>
</ResourceSet>
</ResourceSets>
</Response>

or an address

<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1">
<Copyright>
Copyright © 2015 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.
</Copyright>
<BrandLogoUri>
http://dev.virtualearth.net/Branding/logo_powered_by.png
</BrandLogoUri>
<StatusCode>200</StatusCode>
<StatusDescription>OK</StatusDescription>
<AuthenticationResultCode>ValidCredentials</AuthenticationResultCode>
<ResourceSets>
<ResourceSet>
<EstimatedTotal>1</EstimatedTotal>
<Resources>
<Location>
<Name>G0A 4B0, QC</Name>
<Point>
<Latitude>46.679374694824219</Latitude>
<Longitude>-72.049674987792969</Longitude>
</Point>
<BoundingBox>
<SouthLatitude>46.675511977253542</SouthLatitude>
<WestLongitude>-72.0571812840852</WestLongitude>
<NorthLatitude>46.683237412394895</NorthLatitude>
<EastLongitude>-72.042168691500734</EastLongitude>
</BoundingBox>
<EntityType>Postcode1</EntityType>
<Address>
<AdminDistrict>QC</AdminDistrict>
<AdminDistrict2>Portneuf</AdminDistrict2>
<CountryRegion>Canada</CountryRegion>
<FormattedAddress>G0A 4B0, QC</FormattedAddress>
<Locality>Saint-Marc-des-Carrières</Locality>
<PostalCode>G0A 4B0</PostalCode>
</Address>
<Confidence>High</Confidence>
<MatchCode>Good</MatchCode>
<GeocodePoint>
<Latitude>46.679374694824219</Latitude>
<Longitude>-72.049674987792969</Longitude>
<CalculationMethod>Rooftop</CalculationMethod>
<UsageType>Display</UsageType>
</GeocodePoint>
</Location>
</Resources>
</ResourceSet>
</ResourceSets>
</Response>

Is there a way to make Bing geocoding API more reliable?

Is it because I use a basic key and they reject my query because the server is overload?

Thank you

2
I'm voting to close this question as off-topic because it is about the Bing API, it only says 'it does not work like I want', this should be asked to Microsoft ...Christophe Roussy

2 Answers

2
votes

Your statement is incorrect since it seems that you are not respecting the Terms of Use that you agreed with while creating the Basic Key.

Those type of key are limited in number of request for a given period, here is a precise article on the MSDN that explain those limits in details:

https://msdn.microsoft.com/en-us/library/dn894107.aspx

And another regarding the status and the code:

https://msdn.microsoft.com/en-us/library/ff701703.aspx

Rate limitation and information

Here is the interesting part to go further managing your error:

Rate Limiting

In the Bing Maps terms of use trial and basic keys are limited in the number of transactions they can generate within a period of time. Windows Store, Windows Phone, and WPF apps have a limit of 50,000 transactions in a 24 hour period. Public facing web sites and non-Windows mobile apps have a limit of 125,000 transactions a year. Rate limiting occurs when the frequency of requests made against the Bing Maps REST and/or SOAP services by an account exceeds these free terms of use. Rate limiting can also occur when the services are under a lot of load. This is done to ensure that the usage from trial and basic keys do no interrupt the services for those using an Enterprise keys. Enterprise keys are not rate limited and the only way to get around rate limiting is to upgrade to an Enterprise key. For more information contact see our Bing Maps Licensing Options page.

When a request is rate limited, the response will return no results. This may be confusing at first as it looks like Bing Maps was unable to find results. To indicate that the request was rate limited a flag is added to the header of the response (X-MS-BM-WS-INFO) which is set to the value of 1 as documented the Status Codes and Error Handling page. To make for a better user experience, applications that use trial or basic keys should look for this flag in the header and handle requests which are rate limited. Something as simple as logging the fact that a request was rate limited in your application log could help when debugging reported issues.

-1
votes

There are lots of other geocoding providers out there. If your application has to be able to depend on a geocoding provider that is fast, scalable, and reliable you will probably end up paying for a premium service.

GeoCoding providers for non-map use