0
votes

Why is it when I request some postcodes from Bing maps I get an incorrect coordinates http://dev.virtualearth.net/REST/v1/Locations?postalCode=IM1+1LD&countryRegion=GB&o=xml&key=MY_BING_KEY

While when I request it using this I get the correct ones http://dev.virtualearth.net/REST/v1/Locations?postalCode=IM1&1LD&countryRegion=GB&o=xml&key=MY_BING_KEY

i.e. when I send IM1+1LD as a postalcode incorrect results are returned, while sending IM1&1LD returns the correct results in the response.

1
It's weird to use '&' as it would be interpreted as another parameter and I assume only IM1 would be taken. You could try to encode the parameter and specify the culture, see: msdn.microsoft.com/en-us/library/ff701709.aspx. Also see this link for complete useful parameters: msdn.microsoft.com/en-us/library/ff701714.aspxNicolas Boonaert

1 Answers

3
votes

The + indicates your are escaping rather than encoding your query. The plus should be %20 instead. Also, in the UK postal codes are a special case. I recommend searching for them using a query search instead like this: http://dev.virtualearth.net/REST/v1/Locations?q=IM1%201LD&o=xml&key=YOUR_KEY

You can find additional tips on use the REST services here: http://www.bing.com/blogs/site_blogs/b/maps/archive/2013/02/14/bing-maps-rest-service-tips-amp-tricks.aspx