Bing Maps Autosuggest API not retunring neigborhood

Alan Baird 21 Reputation points Microsoft Employee
2022-10-26T05:01:12.843+00:00

Hi The Autosuggest API is not returning the neighborhood property for NZ via the API. I see this same behavior on your Bing Maps website when it brings up the suggested addresses and you can see that the neighborhood is missing. However it does show the neighborhood on the screen after you load it.

Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
390 questions
{count} votes

Accepted answer
  1. rbrundritt 16,236 Reputation points Microsoft Employee
    2022-11-14T22:27:14.4+00:00

    The autosuggest API returns a list of suggested names, not the full address/coordinate details. To get the full details you have to take the formatted address and pass them through the geocoding API. If I pass 23 Meteor Place, Schnapper Rock, Auckland 0632 into the location query API: https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/find-a-location-by-query and tell it to include the neighborhood, Schnapper Rock is in the response.

    For example: https://dev.virtualearth.net/REST/v1/Locations/?q=23%20Meteor%20Place%20Auckland%200632&inclnb=1&key=<Your Bing Maps Key>

    Will return:

       {  
         "authenticationResultCode": "ValidCredentials",  
         "brandLogoUri": "http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",  
         "copyright": "Copyright....",  
         "resourceSets": [  
           {  
             "estimatedTotal": 1,  
             "resources": [  
               {  
                 "__type": "Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",  
                 "bbox": [  
                   -36.759,  
                   174.68291,  
                   -36.7572,  
                   174.68515  
                 ],  
                 "name": "23 Meteor Place, Schnapper Rock, Auckland 0632",  
                 "point": {  
                   "type": "Point",  
                   "coordinates": [  
                     -36.7581,  
                     174.68403  
                   ]  
                 },  
                 "address": {  
                   "addressLine": "23 Meteor Place",  
                   "adminDistrict": "North Island",  
                   "adminDistrict2": "Auckland",  
                   "countryRegion": "New Zealand",  
                   "formattedAddress": "23 Meteor Place, Schnapper Rock, Auckland 0632",  
                   "locality": "Auckland",  
                   "neighborhood": "Schnapper Rock",  
                   "postalCode": "0632"  
                 },  
                 "confidence": "High",  
                 "entityType": "Address",  
                 "geocodePoints": [  
                   {  
                     "type": "Point",  
                     "coordinates": [  
                       -36.7581,  
                       174.68403  
                     ],  
                     "calculationMethod": "Rooftop",  
                     "usageTypes": [  
                       "Display"  
                     ]  
                   },  
                   {  
                     "type": "Point",  
                     "coordinates": [  
                       -36.7584,  
                       174.68457  
                     ],  
                     "calculationMethod": "None",  
                     "usageTypes": [  
                       "Route"  
                     ]  
                   }  
                 ],  
                 "matchCodes": [  
                   "Good"  
                 ]  
               }  
             ]  
           }  
         ],  
         "statusCode": 200,  
         "statusDescription": "OK",  
         "traceId": "74988bfc07bf4..."  
       }  
    
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. IoTGirl 2,976 Reputation points Microsoft Employee
    2022-11-01T23:24:21.64+00:00

    Hi Alan,

    The website has a number of other sources, including settings that are passed by the browser. Can you try your repro with https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/autosuggestui and provide us a sample?

    Please note the business Entities and Address entities can often contain different levels of data and the public website does a geocode call to fill those in so you may just need to add that step to get the data you seek.

    Sincerely,
    IoTGirl

    1 person found this answer helpful.

  2. Alan Baird 21 Reputation points Microsoft Employee
    2022-11-14T20:13:30.487+00:00

    Here we go. You can see that the JSON response does not contain the - neighborhood information. However when you use Bing Maps via the website it also does not show the neighborhood in the auto suggests but it does show it in the final result.

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http://dev.virtualearth.net/Branding/logo_powered_by.png","copyright":"Copyright © 2022 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.","resourceSets":[{"estimatedTotal":1,"resources":[{"__type":"Autosuggest:http://schemas.microsoft.com/search/local/ws/rest/v1","value":[{"__type":"Address","address":{"countryRegion":"New Zealand","locality":"Auckland","adminDistrict":"AUK","countryRegionIso2":"NZ","houseNumber":"23","postalCode":"0632","addressLine":"23 Meteor Place","streetName":"Meteor Place","formattedAddress":"23 Meteor Place Auckland 0632"}},{"__type":"Address","address":{"countryRegion":"New Zealand","locality":"Auckland","adminDistrict":"AUK","countryRegionIso2":"NZ","houseNumber":"23","postalCode":"0618","addressLine":"23 Meteor Road","streetName":"Meteor Road","formattedAddress":"23 Meteor Road Auckland 0618"}},{"__type":"Address","address":{"countryRegion":"New Zealand","locality":"Auckland","adminDistrict":"AUK","countryRegionIso2":"NZ","houseNumber":"23","postalCode":"0618","addressLine":"23 Meteor Rd","streetName":"Meteor Rd","formattedAddress":"23 Meteor Rd Auckland 0618"}},{"__type":"Address","address":{"countryRegion":"New Zealand","locality":"Auckland","adminDistrict":"AUK","countryRegionIso2":"NZ","houseNumber":"23","postalCode":"0632","addressLine":"23 Meteor Pl","streetName":"Meteor Pl","formattedAddress":"23 Meteor Pl Auckland 0632"}}]}]}],"statusCode":200,"statusDescription":"OK","traceId":"887f610373944323bdad15da1f4c812a|PUS0004C50|0.0.0.1"}260217-suggestions.png260263-result.png

    0 comments No comments

  3. Alan Baird 21 Reputation points Microsoft Employee
    2022-11-15T02:28:50.463+00:00

    Thanks. That works.

    As a suggestion it would be nice if the autosuggest also returned the neighborhood value as well. It would avoid selecting the wrong address when cities contain 2 streets with the same name, and it saves doing an additional API query. Google Maps returns the neighborhood value in its auto suggest results.

    Cheers

    0 comments No comments