Bing Maps Local Search API restricted to a bounding box returns POIs outside bbox

Thomas Dekeyser 21 Reputation points
2021-10-28T13:04:11.6+00:00

Using the LocalSearch API, i want to get all "EatDrink" POIs inside a given bbox. The API call is however returning my POIs outside (>500m) this bbox. I don't think this is expected behavior according the documentation https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/local-search were I read "....Search by Query Restricted to a Bounding Box...".

API GET request
https://dev.virtualearth.net/REST/v1/LocalSearch?key={myKey}&userMapView=47.593082,-122.33416351000001,47.59338221,-122.33366902&maxResults=25&type=EatDrink

Returns
{
...
"resourceSets": [
{
"estimatedTotal": 23,
"resources": [
...
{
"__type": "SearchResult:http://schemas.microsoft.com/search/local/ws/rest/v1",
"name": "Jade Garden",
"point": {
"type": "Point",
"coordinates": [
47.5985107421875,
-122.32350921630859
]
},
"Address": {
"addressLine": "424 7th Ave S",
"adminDistrict": "WA",
"countryRegion": "US",
"formattedAddress": "424 7th Ave S, Seattle, WA, 98104",
"locality": "Seattle",
"postalCode": "98104"
},
"PhoneNumber": "(206) 622-8181",
"Website": null,
"entityType": "Restaurant",
"geocodePoints": [
{
"type": "Point",
"coordinates": [
47.5985107421875,
-122.32350921630859
],
"calculationMethod": "Rooftop",
"usageTypes": [
"Display"
]
}
]
}
...
]
}
],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "8b0c711ec6b9497991a1e952476a056f|DU00002754|0.0.0.0"
}

144516-q-localsearch-api.png

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
Windows Maps
Windows Maps
A Microsoft app that provides voice navigation and turn-by-turn driving, transit, and walking directions.
245 questions
{count} votes

Accepted answer
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2021-11-01T00:30:34.74+00:00

    Hi Thomas,

    I expect you are correct and you have hit a low tolerance limit with the API. Realistically that box is too small to have an expected list of max 25 businesses but I don't have any details of the lower bounds of the API. Can you please explain the reason that you would need such a small bounding box?

    Sincerely,
    IoTGirl


1 additional answer

Sort by: Most helpful
  1. rbrundritt 15,231 Reputation points Microsoft Employee
    2021-10-28T15:18:32.49+00:00

    All user location information is used to weight the results and provide local relevance, but is not a hard restriction. This is very noticeable when you use a really small bounding box. If you need to restrict the results to a bounding box, you will need to filter the results using code.

    Alternatively, if you are early in your development, give Azure Maps a try. They have several location search services with more options. The following service does what you are looking for: https://learn.microsoft.com/en-us/rest/api/maps/search/get-search-poi

    0 comments No comments