question

ThomasDekeyser-8143 avatar image
0 Votes"
ThomasDekeyser-8143 asked AshokPeddakotla-MSFT commented

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

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://docs.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-mapswindows-maps
q-localsearch-api.png (750.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@ThomasDekeyser-8143 Wanted to follow up with you to understand whether the below information helped. Please let us know if there are any queries.

If an answer is helpful, please click on 130616-image.png or upvote 130671-image.png which might help other community members reading this thread.

0 Votes 0 ·
IoTGirl avatar image
0 Votes"
IoTGirl answered IoTGirl edited

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

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thx for the reply.


I was trying to fetch all poi's of a certain category in a bigger bbox. As it can happen that those poi's are really concentrated, i have decided to split the big bbox in rather small parts and do individual API calls for each of them. A poormens solution i agree. But i could not find a better matching Bing maps API call...

0 Votes 0 ·
IoTGirl avatar image IoTGirl ThomasDekeyser-8143 ·

Hi Thomas,

I have the following answer for you from the Local Search team, it aligns with Ricky's answer:

The Local Search relevance stack uses the bounding box as a “strong suggestion” of where to look for what the user is searching for, but it does not truncate results outside the specified box if they are determined to be relevant given the particular details of the user’s search (e.g. their search intent, the location context, the availability of results within and near the bounding box, etc).
If the caller desires this “hard boundary truncation”-type behavior, they have all the information they need in order to implement it on the client side: They know the bounding box they specified, and they know the latlon location of each of the results that is returned, so they can test each result to see if it lies within their desired bounding box or not.

Sincerely,
IoTGirl

0 Votes 0 ·
rbrundritt avatar image
0 Votes"
rbrundritt answered

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://docs.microsoft.com/en-us/rest/api/maps/search/get-search-poi

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.