none
GeoDataAPIManager.getBoundary given wrong boundary RRS feed

  • Question

  • 1. I have used the GeoDataAPIManager.getBoundary of V8 for drawing city of New York.
     example:
    var city= ['new york city, ny, USA'];
    var geoDataRequestOptions = {
        entityType: 'PopulatedPlace'
    };
    Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
        //Use the GeoData API manager to get the boundary
        Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary(city, geoDataRequestOptions, map, function (data) {
            if (data.results && data.results.length > 0) {
                map.entities.push(data.results[0].Polygons);
            }
        });
    });
     
    It’s not highlight whole boundary of New York. that shown in new version of bing map.
     
    2. similarly I use GeoDataAPIManager.getBoundary for drawing state of USA by using abbreviations name.
     example:
    //Create an array of locations to get the boundaries of
    var states= ['WA, USA', 'CA, USA', 'MI, USA', 'TX, USA', 'NY, USA', 'UT, USA', 'VI, Australia'];
    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) {
                map.entities.push(data.results[0].Polygons);
            }
        });
    });
     
    It work fine for most of states abbreviations name but it not work for UT i.e UTAH state in USA. it return data of TEXAS in successcallback of UT i.e UTAH state.  
    Wednesday, May 4, 2016 2:03 PM

Answers

  • For your first issue, the cause is that by default the service returns the first/most prominent boundary as there are many applications require this. To return all boundaries you can add the getAllPolygons option. So update your getDataRequestOptions to the following:

    var geoDataRequestOptions = {
        entityType: 'PopulatedPlace',
        getAllPolygons: true
    };

    For your second issue, I'll start off with a background on how the service works. When you pass in a textual query rather than a coordinate, it simply geocodes the query and then uses the resulting coordinate to find any polygon that intersects with the coordinate. Now, if you geocode "UT, USA", the first result returned by the geocoder currently is "University of Texas" which is in Austin, TX. As a result the coordinate is in Texas and thus the reason why a boundary for Texas is returned. That said, "UT" should return "Utah" as the first result when geocoding. This is a known issue in our geocoder. Currently we are in the process of creating a whole new backend to our geocoder and are currently testing it out on the bing.com/maps and in our autosuggest module. Once quality control testing is complete and we are sure that the new geocoder is overall much better than our current geocoder, we will be updating the backend which will resolve this issue. I don't have an exact timeline for when this will happen, but do know that it is planned for sometime this year. When this is done, this issue will automatically be resolved. In the meantime there are a couple of workarounds; provide the fill state name in the query, pass in a set of coordinates that are within the state of Utah.


    [Blog] [twitter] [LinkedIn]

    Wednesday, May 4, 2016 6:30 PM
  • Bing Maps V7 uses the same geocoder. V7 also didn't have any boundary data service built into it like V8, so any boundary data you saw in V7, didn't come from Bing Maps.

    [Blog] [twitter] [LinkedIn]

    Thursday, May 5, 2016 4:54 PM

All replies

  • For your first issue, the cause is that by default the service returns the first/most prominent boundary as there are many applications require this. To return all boundaries you can add the getAllPolygons option. So update your getDataRequestOptions to the following:

    var geoDataRequestOptions = {
        entityType: 'PopulatedPlace',
        getAllPolygons: true
    };

    For your second issue, I'll start off with a background on how the service works. When you pass in a textual query rather than a coordinate, it simply geocodes the query and then uses the resulting coordinate to find any polygon that intersects with the coordinate. Now, if you geocode "UT, USA", the first result returned by the geocoder currently is "University of Texas" which is in Austin, TX. As a result the coordinate is in Texas and thus the reason why a boundary for Texas is returned. That said, "UT" should return "Utah" as the first result when geocoding. This is a known issue in our geocoder. Currently we are in the process of creating a whole new backend to our geocoder and are currently testing it out on the bing.com/maps and in our autosuggest module. Once quality control testing is complete and we are sure that the new geocoder is overall much better than our current geocoder, we will be updating the backend which will resolve this issue. I don't have an exact timeline for when this will happen, but do know that it is planned for sometime this year. When this is done, this issue will automatically be resolved. In the meantime there are a couple of workarounds; provide the fill state name in the query, pass in a set of coordinates that are within the state of Utah.


    [Blog] [twitter] [LinkedIn]

    Wednesday, May 4, 2016 6:30 PM
  • Thank you for above reply.

    I wanted to know whether switching back to bing map V7 version will help me in any of the points mentioned below:

    • Drawing proper polygon boundaries using the abbreviation names of states like UT for Utah
    • Combining the boundaries of all the sub-division under the parent division. For ex., In earlier version we used to see single boundary for New York city combining all the five boroughs (Brooklyn, Manhattan, Staten Island, Bronx, Queens) but currently it is showing as different divisions

    Did you make any changes in bing map V7 geocoder also?

    Thursday, May 5, 2016 12:42 PM
  • Bing Maps V7 uses the same geocoder. V7 also didn't have any boundary data service built into it like V8, so any boundary data you saw in V7, didn't come from Bing Maps.

    [Blog] [twitter] [LinkedIn]

    Thursday, May 5, 2016 4:54 PM
  • Thank you replying to above query.

    I have used the GeoDataAPIManager.getBoundary of V8 for drawing polygon in bing map. I have developed  a small project using bing map. Please find below the script URL on html page:

    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap&branch=experimental' async defer>

    </script>

    OR

    <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?branch=experimental' >

    </script>

    This is working perfectly fine in chrome and firefox browser but in IE 10/11, it stuck most of time.

    It doesn’t show anything on map. Please find below the console error from mapcontrol file.

    unable to get property  'prototype' of undefined or null reference

    could you please help us in finding solution for IE browser.

    Thursday, May 12, 2016 12:27 PM
  • I wasn't able to reproduce this issue. I do most of my testing on IE 11 first. Just tried clearing cache and refreshing page and the app still worked fine for me. However it appears that there is an issue on IE10. I'll have the team look into this to see what changed as I'm certain IE10 was working before.

    [Blog] [twitter] [LinkedIn]

    Thursday, May 12, 2016 5:26 PM