Monday, June 25, 2012 6:34 PM
I've been testing out the geocoding api and seeing how much I can help it along by passing a "userLocation" lat long which I know to be in the right area. For example, I've been seeing if I can get Bing to find 45 main street, brooklyn ny based on just "45 main street" by giving it a near by lat/long. The default if you simply enter "45 main street brooklyn" is otherwise "45 main street, brooklyn MS", on the other side of the country. So first I tried adding a nearby lat/long:
This returned 2 items, the brooklyn MS and brooklyn NY addresses, both with high confidence.
So at first I wasn't sure it was actually respecting the "ul" parameter so I decided to add another parameter, culture code "sv" for sweden. just for laughs.
http://dev.virtualearth.net/REST/v1/Locations?query=45 main street brooklyn&includeNeighborhood=1&maxResults=100&key=[key]&ul=40.702714249491692,-73.99063803255558&c=sv
This returns 1 item, the Brooklyn NY address which is right by the "ul" lat long.... so that was odd. Then I tried a few different culture codes, such as "en" for us english:
http://dev.virtualearth.net/REST/v1/Locations?query=45 main street brooklyn&includeNeighborhood=1&maxResults=100&key=[key]&ul=40.702714249491692,-73.99063803255558&c=en
(returns the Brooklyn MS result).
Is there any reason I should be getting different results based on applying different culture codes?
Tuesday, June 26, 2012 10:40 AMOwnerYes. The culture code is more relevant to a search than an IP address. The IP address is used some times and I find makes the most difference when hosting your code in the cloud. I usually set the IP address to 127.0.0.1 when deploying code to the cloud to ensure the IP address of the server does not affect the query. The culture has a lot more bearing to the query as this often gives a better indication to where someone is looking. Outside of the US the culture parameter is an extremely important one as Bing Maps by default assumes a culture of en-US. In other countries that culture makes a big difference. Take for example city names and postal/zip codes, these are often reused in many countries. For example, if you search for zip code "01370", by default you end up with "01370, MA" as the first result. Changing the culture to fr-FR and doing the same search the first result is "01370, France".