none
GeoDataAPIManager.getBoundary for wrong input RRS feed

  • Question

  • Hi,

    We have used the GeoDataAPIManager.getBoundary of V8. It works fine for correct data but when we enter wrong data for example "Kiji8569" then sucesscallback is not called so it is difficult to handle this.

    Below is the sample code that we are using.

            var states = ['NY, USA', 'CA, USA', 'GA, USA', 'MI, USA', 'Kiji8569', 'TX, USA'];

            var geoDataRequestOptions = {

                entityType: 'AdminDivision1'

            };

            Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {

                //Use the GeoData API manager to get the boundary

                Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary(states, geoDataRequestOptions, map, function (data) {

                    if (data.results && data.results.length > 0) {

                        for (var i = 0; i < data.results[0].Polygons.length; i++) {

                            data.results[0].Polygons[i].setOptions({

                                fillColor: 'rgba(189,0,38,0.4)',

                                strokeColor: 'black'

                            });         

                        }

                        map.entities.push(data.results[0].Polygons);

                    }

                });

            });    

        });   

    Is there any way to get the sucesscallback for wrong data.

    Thanks!

    Balasaheb  


    Balasaheb

    Monday, April 25, 2016 1:59 PM

Answers

  • Update: The team has made a fix for this. Now, when an error occurs with the request it acts the same way as when it can't find a boundary. It triggers the callback with basic information, but no boundary. This is checked into the experimental branch of the SDK and will be merged with the release branch in the coming weeks. To test, add "&branch=experimental" to the map script URL.

    [Blog] [twitter] [LinkedIn]

    Thursday, April 28, 2016 12:12 AM

All replies

  • There are two types of situations in which a boundary is not returned;

    1. You pass in a valid location but a boundary isn't available. This will trigger the callback function but without a boundary.
    2. You pass in a location which fails to be geocoded. The GeoData API service returns a 404 error which currently is ignored.

    I'll have the dev team look at the second scenario and consider catching this error and either providing an error callback or simply have it call the existing callback function without a boundary.


    [Blog] [twitter] [LinkedIn]

    Monday, April 25, 2016 8:08 PM
  • Hi,

    That will be good when you pass callback function in case of second scenario.

    Thanks!

    Balasaheb


    Balasaheb


    Tuesday, April 26, 2016 1:08 PM
  • Update: The team has made a fix for this. Now, when an error occurs with the request it acts the same way as when it can't find a boundary. It triggers the callback with basic information, but no boundary. This is checked into the experimental branch of the SDK and will be merged with the release branch in the coming weeks. To test, add "&branch=experimental" to the map script URL.

    [Blog] [twitter] [LinkedIn]

    Thursday, April 28, 2016 12:12 AM