question

s001-3869 avatar image
0 Votes"
s001-3869 asked IoTGirl commented

Why is bing maps api less accurate than bing.com/maps ?

For example, this API query:
dev.virtualearth.net/REST/v1/Locations?query=211%20T%20%26%20C%20Way%20Haverhill,%20NH%2003785&userLocation=43.336900,-71.647802&maxResults=1
Returns: ...
"address":{"adminDistrict":"NH","adminDistrict2":"Grafton County","countryRegion":"United States","formattedAddress":"Haverhill, NH","locality":"Haverhill"},
"confidence":"Medium",
"entityType":"PopulatedPlace", ...

While the website: bing.com/maps?q=211%20T%20%26%20C%20Way%20Haverhill,%20NH%2003785
Returns a proper hit.

How can I match the accuracy of the website when using the API?

windows-maps
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.

IoTGirl avatar image
0 Votes"
IoTGirl answered s001-3869 commented

Hi @s001-3869,

I can address your question by telling you there are three different APIs that make up the answer:
1. The Documentation for Location API calls are here: https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/ but your call is using the less precise query string call instead of the Address call.
2. Bing.com/Maps uses the AutoSuggest API that allows you to type characters then choose from a potential list

You should use the API that best matches your scenario but if you are looking for a more accurate address, try Location by address where you separate the address into the component parts before making the call.

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.

Hello IoTGirl,
The documentation suggests no difference between the accuracy of Address-based or Query-based calls.
Furthermore, before submitting this question, I did test the Address-based call.
It returned identically to the Query-based call.

The traceId for the Query call was: "0a1a99b87f6b4bcc9e0cf7d569dc8347|BN000021D9|0.0.0.1|Ref A: 28F995BCABC44B3A91DCA2BCF4CBB5E7 Ref B: BN3EDGE0508 Ref C: 2021-03-07T17:51:18Z"
The traceId for the Address call was: "3ccc3bc88b4c486486697dd3a2cf0653|BN000021CA|0.0.0.1|Ref A: E8DF9503290348D3B7D402B059445C9B Ref B: BN3EDGE0819 Ref C: 2021-03-07T18:02:50Z"

(Message is apparently too long... will post another.)

0 Votes 0 ·

I just tried your suggestion to use the AutoSuggest API:
dev.virtualearth.net/REST/v1/Autosuggest?query=211%20T%20%26%20C%20Way%20Haverhill,%20NH%2003785&userLocation=43.336900,-71.647802&maxResults=1

But unfortunately it returned nothing:
{ "resourceSets": [ {
"estimatedTotal": 1,
"resources": [ {
"__type": "Autosuggest:http://schemas.microsoft.com/search/local/ws/rest/v1",
"value": [] } ] } ],
"statusCode": 200,
"statusDescription": "OK",
"traceId": "393e7f8456054def9a03c57fb53d8f08|CO000010E3|0.0.0.1" }

It seems there is some inherent disconnect between the API and website.

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

Hello @s001-3869,

Please try the API with the same context. When hosted in the browser, the Bing Maps V8 control gets context from the Browser. In the left menu of https://www.bing.com/api/maps/sdk/mapcontrol/isdk you can find a number of AutoSuggest samples.

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.

I included context with all of my requests; it made no difference.
The point "userLocation=43.336900,-71.647802" is nearby the location I was searching for.

0 Votes 0 ·

Hi @s001-3869 ,

Please note that all "Location" APIs for Bing Maps for Enterprise are documented here: https://docs.microsoft.com/en-us/bingmaps/rest-services/locations/

  • Location by Address -> Lets you pre-decide the country, state and more where that address is expected to be, ensuring a location where you expect it

  • Location by Query -> Takes no extra detail into account and tried to match a text string to an address worldwide

The Bing website uses all of the settings in the browser to do that tuning and get you that match, if you do not provide that same tuning to the API call, it will have different results, by design.

This is exactly why the API has a different result than the website as they both are accessing the same service at the back end.

Sincerely,
IoTGirl



0 Votes 0 ·