none
Spatial Data Services - incomplete API to handle errors? RRS feed

  • Question

  • I am using the Javascript Bing Maps V8, that happens to use Spatial Data Services.

    I have found that there aren't any "error callbacks" when an invalid location type is specified.

    For an example, look at the LOCATION value, it's a LAT/LON object.

            spatialFilter: {
                spatialFilterType: 'nearby',
                location: map.getCenter(),
                radius: 25
            },

    But if I pass an invalid string as such...

            spatialFilter: {
                spatialFilterType: 'nearby',
                location: "blah blah blah blah",
                radius: 25
            },

    I get a 404 error on the request and the originating part of the request...

    Microsoft.Maps.SpatialDataService.QueryAPIManager.search(...)

    does not get any response from the 404 error.

    Basically I have no way for my application to detect if there are any results or not (throw an error to the user).

    I was thinking of generating the Spatial Data Services URL manually and fire it off via AJAX request to at least get a 404 error. Is this the right way to work around this? 

    My issue can be reproduced using the following demo site, just replace the "LOCATION" value with garbage data.

    https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk#sdsNearbySearch+JS

    Monday, June 5, 2017 6:15 PM

Answers

  • There are plans to add error callback functions in the future. In the mean time, you can access the SDS services directly using the REST services. Here is the API documentation: https://msdn.microsoft.com/en-us/library/gg585126.aspx

    [Blog] [twitter] [LinkedIn]

    Monday, June 5, 2017 7:38 PM
  • The REST and Spatial Data Services are completely different API's that do very different things, but do have some overlapping data sets. Here is some details:

    REST APIs:

    • Forward and reverse geocoding - on demand service of individual locations.
    • Static imagery and imagery metadata
    • Routing
    • Traffic data

    Spatial Data Services (SDS):

    • Batch forward/reverse geocoding of up to 200,000 locations in a single request. This uses the same data set as the REST services and basically wraps it internally and processes all the requests in parallel within the Bing servers for faster processing. This saves on the back and forth of making individual requests using the REST services. This API can take anywhere from a few minutes to a few hours depending on size of request and demand for this service.
    • Host data sources and expose them as a spatial REST services. You can upload custom data sources and perform searches such as nearby (radial) search, bounding box search, along a route search, intersection (i.e. find in polygon), and find by property (i.e. has some column value equal to some other value). Bing Maps also exposes several data sources through this API. One of these data sources has traffic data which is the same data that is in the REST services, but allows you to query this data in different ways.
    • GeoData API - Provides boundary data such as zip codes, cities, states, countries. These boundaries conform to the culture settings used in the request. For example, the boundary returned for India would vary depending the views of the country culture settings.

    [Blog] [twitter] [LinkedIn]

    Tuesday, June 6, 2017 9:14 PM
  • Good news, the search function for the Query API now supports an error callback parameter in the experimental branch. This will be added to the main release branch in the next update.

    Here is the new structure of this function:

    public static search(queryOptions: IQueryAPIOptions,
            credentials: string | SDKMap,
            callback: (data: IPrimitive[], inlineCount?: number) => void,
            styles?: IStylesOptions,
            withoutLocationInfo?: boolean,
            errorCallback?: (networkStatus?: NetworkStatus, statusMessage?: string) => void): void;


    [Blog] [twitter] [LinkedIn]



    Saturday, June 24, 2017 12:03 AM

All replies

  • There are plans to add error callback functions in the future. In the mean time, you can access the SDS services directly using the REST services. Here is the API documentation: https://msdn.microsoft.com/en-us/library/gg585126.aspx

    [Blog] [twitter] [LinkedIn]

    Monday, June 5, 2017 7:38 PM
  • Hello Ricky!

    Would you happen to know when the error callback would be implemented for:

    Microsoft.Maps.SpatialDataService.QueryAPIManager.search

    I'm working on a commercial product and I'd like to know the general timeframe (if possible).

    Thanks!

    Tuesday, June 6, 2017 6:00 PM
  • And also, does the REST service and Javascript Data Spatial Services return the same search results?

    Specifically, Microsoft.Maps.SpatialDataService.QueryAPIManager.search

    Assuming the REST URL call and the Javascript are both sending the exact same parameters.

    Tuesday, June 6, 2017 6:21 PM
  • The REST and Spatial Data Services are completely different API's that do very different things, but do have some overlapping data sets. Here is some details:

    REST APIs:

    • Forward and reverse geocoding - on demand service of individual locations.
    • Static imagery and imagery metadata
    • Routing
    • Traffic data

    Spatial Data Services (SDS):

    • Batch forward/reverse geocoding of up to 200,000 locations in a single request. This uses the same data set as the REST services and basically wraps it internally and processes all the requests in parallel within the Bing servers for faster processing. This saves on the back and forth of making individual requests using the REST services. This API can take anywhere from a few minutes to a few hours depending on size of request and demand for this service.
    • Host data sources and expose them as a spatial REST services. You can upload custom data sources and perform searches such as nearby (radial) search, bounding box search, along a route search, intersection (i.e. find in polygon), and find by property (i.e. has some column value equal to some other value). Bing Maps also exposes several data sources through this API. One of these data sources has traffic data which is the same data that is in the REST services, but allows you to query this data in different ways.
    • GeoData API - Provides boundary data such as zip codes, cities, states, countries. These boundaries conform to the culture settings used in the request. For example, the boundary returned for India would vary depending the views of the country culture settings.

    [Blog] [twitter] [LinkedIn]

    Tuesday, June 6, 2017 9:14 PM
  • Good news, the search function for the Query API now supports an error callback parameter in the experimental branch. This will be added to the main release branch in the next update.

    Here is the new structure of this function:

    public static search(queryOptions: IQueryAPIOptions,
            credentials: string | SDKMap,
            callback: (data: IPrimitive[], inlineCount?: number) => void,
            styles?: IStylesOptions,
            withoutLocationInfo?: boolean,
            errorCallback?: (networkStatus?: NetworkStatus, statusMessage?: string) => void): void;


    [Blog] [twitter] [LinkedIn]



    Saturday, June 24, 2017 12:03 AM
  • Thank you!!!!!
    Thursday, August 17, 2017 1:32 PM