The bounding box is meant to help influence the relevance of the results and is not a filter.
Azure Maps fuzzy search results are not limited to bounding box
When I perform a fuzzy search using the Azure Maps REST API, the results are not limited to the bounding box I specify. This makes searching for partial addresses much less useful, since many/most/all of the results are from other states and the relevant results from the specified state are not included in the first 10-20 results.
For example, if I search for "123 Main" and specify a bounding box that covers the state of Louisiana, I should get a half dozen or so point addresses in the results, and all the results should be constrained to the bounding box. (There may be a few results from the edges of surrounding states since the bounding box is a rectangle.) Instead, I get results from Connecticut, Ohio, Massachusetts, and so on that are clearly outside the bounding box.
The documentation clearly states, "You can use the btmRight and topleft parameters to set the bounding box. These parameters restrict the search to a specific area on the map."
https://learn.microsoft.com/en-us/azure/azure-maps/how-to-use-best-practices-for-search#limit-search-results
https://learn.microsoft.com/en-us/rest/api/maps/search/get-search-fuzzy
The test query I am using is:
Am I doing something wrong? How do I limit the search results to the bounding box?
Azure Maps
2 answers
Sort by: Most helpful
-
rbrundritt 20,921 Reputation points Microsoft Employee Moderator
2023-01-06T22:34:07.473+00:00 -
Kevin Flood 51 Reputation points
2023-05-05T09:45:03.8+00:00 @Jeremiah Mercier I'd noticed this issue too i.e. issues with GeoBiasing and issue when using
lat&lon
params cancels/overridestopLeft&topRight
params.I agree with you that it's a real issue and was not behaving as intended. I don't think it was a documentation mistake. I also think the suggested fix to use
countrySet
param was essentially a hack to give "better" results.However, the issue appears to have been resolved now. Using your examples above:
- Using
topLeft&topRight
params only
https://atlas.microsoft.com/search/fuzzy/json?subscription-key=SUBSCRIPTION_KEY&api-version=1.0&query=123+Main&idxSet=Addr,PAD,POI,XStr&limit=20&typeahead=true&
topLeft=33.019457,-94.043147&btmRight=28.928609,-88.817017
Gives result:
- Using both
topLeft&topRight
params andlat&lon
params:
https://atlas.microsoft.com/search/fuzzy/json?subscription-key=SUBSCRIPTION_KEY&api-version=1.0&query=123+Main&idxSet=Addr,PAD,POI,XStr&limit=20&typeahead=true&
topLeft=33.019457,-94.043147&btmRight=28.928609,-88.817017&lat=30.3618&lon=-91.1067
Notes:
- The
countrySet
param has not been used in either of these examples yet the result are what you'd expect. This param is now only really required if you have a usecase where you need a further filter so that, for example, you only want to return results on one side of a national border even though the view covers more than one country. - The lat lon bias (green marker) now works with the bounding box params.
- Using