none
Finding a location by query does not return useful address information RRS feed

  • Question

  • Summary: When attempting to use the Locations API (https://msdn.microsoft.com/en-us/library/ff701711.aspx) to get the address of a business, the results do not contain the address of the business or its lat/long.

    Scenario: I want to use the Locations API to find the address of Loft Coffee near US ZIP code 98201

    Repro steps:

    1. ```curl http://dev.virtualearth.net/REST/v1/Locations?q=loft%20coffee&key=REDACTED&c=US&inclnb=1&postalCode=98201```

    Expected Results:

    The JSON payload should have an `address` object that looks similar to:

    ```

    "address": {
                "adminDistrict": "WA",
                "adminDistrict2": "Snohomish",
                "countryRegion": "United States",
                "formattedAddress": "1309 Hewitt Ave, Everett, WA 98201",
                "locality": "Everett",
                "postalCode": "98201"
              },

    ```

    and a `coordinates` object that is similar to:

    ```

    "coordinates": [
         47.9796327,
           -122.2123069],

    ```

    Actual results:

    The JSON payload has an `address` object that looks similar to:

    ```

    "address": {
                "adminDistrict": "WA",
                "adminDistrict2": "Snohomish",
                "countryRegion": "United States",
                "formattedAddress": "98201, WA",
                "locality": "Everett",
                "postalCode": "98201"
              },

    ```

    and a `coordinates` object that is similar to:

    ```

    "coordinates": [
                    47.9789276123047,
                    -122.20866394043
                  ],

    ```

    Notes:

    Currently, we are able to search for businesses via HTTP requests like:

    ```

    curl http://dev.virtualearth.net:80/services/v1/SearchService/SearchService.asmx/Search2?keyword=%22tutta%20bella%22\&location=98103\&token=REDACTED\&count=5\&culture=en-us\&entityType=Business\&jsonso=r2\&locationCoordinates=\&mapBounds=\&query=\&sortOrder=\&startingIndex=

    ```

    I'm hoping to find a way to search for businesses through this API as well.

    • Edited by davidann01 Wednesday, June 21, 2017 3:46 PM
    Tuesday, June 20, 2017 6:38 PM

Answers

  • This is two be expected for two reasons:

    • the location API is for addresses/places, not business/point of interest searches.
    • The primary purpose of a geocoder (location API) is to take an address or place query and return its approximate coordinate. Any other data returned in the response is a bonus. Geocoders in general are not designed to be address validators or auto complete services.

    [Blog] [twitter] [LinkedIn]

    Wednesday, June 21, 2017 2:10 AM
  • There is no direct replacement for that feature. It is being deprecated. The only options currently are to use the point of interest data sources in the bing spatial data services, which doesn't support wild card searches and likely won't work in scenario. Alternatively look at using one of the many 3rd party APIs that exist for this such as Yelp.

    [Blog] [twitter] [LinkedIn]

    Thursday, June 22, 2017 3:31 PM

All replies

  • This is two be expected for two reasons:

    • the location API is for addresses/places, not business/point of interest searches.
    • The primary purpose of a geocoder (location API) is to take an address or place query and return its approximate coordinate. Any other data returned in the response is a bonus. Geocoders in general are not designed to be address validators or auto complete services.

    [Blog] [twitter] [LinkedIn]

    Wednesday, June 21, 2017 2:10 AM
  • Thanks for getting back to me, Ricky.

    If the Location API is not appropriate for business searches, what would be the more appropriate API?  With the previous version of the API, that is being deprecated, I'm able to run requests like:

    ```

    curl http://dev.virtualearth.net:80/services/v1/SearchService/SearchService.asmx/Search2?keyword=%22tutta%20bella%22\&location=98103\&token=REDACTED\&count=5\&culture=en-us\&entityType=Business\&jsonso=r2\&locationCoordinates=\&mapBounds=\&query=\&sortOrder=\&startingIndex=

    ```

    In order to query for businesses.

    Is there an analogous was to do that with the Spatial API, or should I be looking into a different API?

    Wednesday, June 21, 2017 3:32 PM
  • There is no direct replacement for that feature. It is being deprecated. The only options currently are to use the point of interest data sources in the bing spatial data services, which doesn't support wild card searches and likely won't work in scenario. Alternatively look at using one of the many 3rd party APIs that exist for this such as Yelp.

    [Blog] [twitter] [LinkedIn]

    Thursday, June 22, 2017 3:31 PM