none
Unable to get location resource with some location points (with CountryRegion) RRS feed

  • Question

  • Hi,

    I have been using REST Services (Location) to identify the country region and it was working. However the response is not as expected few days ago. For some coordinates the api returns the resources array, but not for all cases. Here is an example.

    ----------------------------------------------------------------------------------------------------

    Coordinates: 22.2817691,114.1924942

    Request URL 1: 
    http://dev.virtualearth.net/REST/v1/Locations/22.2817691,114.1924942?includeEntityTypes=CountryRegion&inclnb=0&incl=ciso2&key=[api_key]&o=json

    JSON Response (Not expected):

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2020 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":0,"resources":[]}],"statusCode":200,"statusDescription":"OK"}

    ----------------------------------------------------------------------------------------------------

    Coordinates: 22.2887936,114.1855241

    Request URL 2: 
    http://dev.virtualearth.net/REST/v1/Locations/22.2887936,114.1855241?includeEntityTypes=CountryRegion&inclnb=0&incl=ciso2&key=[api_key]&o=json

    JSON Response (Expected) :

    {"authenticationResultCode":"ValidCredentials","brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png","copyright":"Copyright © 2020 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":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1","bbox":[22.152517318725586,113.84365844726562,22.55706787109375,114.44722747802734],"name":"Hong Kong SAR","point":{"type":"Point","coordinates":[22.333080291748047,114.19122314453125]},"address":{"countryRegion":"Hong Kong SAR","formattedAddress":"Hong Kong SAR","countryRegionIso2":"HK"},"confidence":"High","entityType":"CountryRegion","geocodePoints":[{"type":"Point","coordinates":[22.333080291748047,114.19122314453125],"calculationMethod":"Rooftop","usageTypes":["Display"]}],"matchCodes":["Good"]}]}],"statusCode":200,"statusDescription":"OK","traceId":"106b5b79e817431791956dd900f3ea08|HK00000C07|0.0.0.1|HK01EAP000001D4"}
    ----------------------------------------------------------------------------------------------------

    But if the request URL is changed as below (remove "includeEntityTypes=CountryRegion"), it still has expected response.

    Coordinates: 22.2817691,114.1924942

    Request URL 3: http://dev.virtualearth.net/REST/v1/Locations/22.2817691,114.1924942?inclnb=0&incl=ciso2&key=[api_key]&o=json

    Response: An json response with a long list of resources array

    ----------------------------------------------------------------------------------------------------

    Does anyone know which format is the best practice of getting location?

    Any help is appreciated. Thank you.

    Thursday, April 9, 2020 1:41 PM

All replies

  • Hi azurewai,

    the Request URL 2 is correct as my knowledge.

    Thank you.


    Thursday, April 9, 2020 2:36 PM
  • Hi azurewai,

    Both of these points seem to be in water to me but you expect them to have the same region result correct?

    Sincerely,

    IoTGirl

    Thursday, April 9, 2020 10:38 PM
    Owner
  • Hi Debasish,

    Thanks. I would like to keep this using format, as the result varies based on the provided coordinates.

    Tuesday, April 14, 2020 2:12 AM
  • Hi IotGirl,

    Yes I hope so, such that the app can continue without a change in the code.

    Tuesday, April 14, 2020 2:18 AM
  • Hi azurewai,

    I have raised this issue with the Geocoder team but I have not heard back from them as yet.  I will reach out again today.

    Sincerely,

    IoTGirl

    Tuesday, April 14, 2020 3:54 PM
    Owner
  • Hi IoTGirl

    Thank you for the help.

    Wednesday, April 15, 2020 6:54 AM
  • Hi AzureWai,

    There is a fix going into production for this but as it involves CountryRegion it may take some time to actually propagate. As a work around you can actually request the region name in the call to force it's inclusion. 

    Please try:

    http://dev.virtualearth.net/REST/v1/Locations/22.2817691%2c114.1924942?includeEntityTypes=CountryRegion,AdminDivision1,AdminDivision2&inclnb=0&incl=ciso2&key=<key>&o=xml
    

    When you include other entity types such as AdminDivision1 and AdminDivision2 in the query, they will be forced to be included in the result.

    My apologies for the time it has taken to get this response but the problem was not well understood.  Now that it has been fully investigated, a fix is on it's way.  The team does work on an agile schedule so I can not provide a timeline but the work around will work now and will still continue work after the fix is in place.  This means you can deploy it now and not have to revisit it later.

    Sincerely,

    IoTGirl

    Friday, May 15, 2020 5:41 PM
    Owner