none
Incorrect boundary plotting using Bing Maps API - Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary() RRS feed

  • Question

  • Hi,

    One of our client faced an issue regarding incorrect boundary plotting in UK. We also replicate the same issue.

    There are 2 scenario as described below:

    1. We are searching Midlothian as a County in Scotland UK. We are getting boundary as shown below in Bing maps

    In google maps we are getting the boundary as shown below:

    1. We have tried to plot the postal code for the Carlisle area (CA), but we are not getting proper results.
      • PostalCode, CA, United Kingdom – no results
      • PostalCode Areas, CA, United Kingdom – selects an area in Lancashire (which is incorrect)
      • PostalCode Areas, CA1,CA2,…,CA27,CA28, United Kingdom – selects an irregular area (left below) as opposed to covering the entire postcode area

    We are using Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary function to get these boundaries, Can you please let me know why we are getting the different boundaries in Bing Maps than google maps?

    Thank you in advance!

    Friday, September 7, 2018 11:39 AM

All replies

  • Hi Pranita,

    Bing maps gets its data from a third party channel so it is critical that you report data issues as instructed at the beginning of this forum.  Please follow the steps at:            

    Sincere thanks,

    IoTGirl

    Friday, September 7, 2018 4:19 PM
    Owner
  • Hi Pranita,

    As you have not provided your exact calls, I will have to guess. For the single Populated region of Carlisle, you would call for a single boundary (https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/sdsloadsingleboundary)

    Please try the following code in the JavaScript section and then press the green circle with the white arrow

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(54.896618, -2.936891),
        zoom: 10 });
    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(map.getCenter(), geoDataRequestOptions, map, function (data) {
            if (data.results && data.results.length > 0) {
                map.entities.push(data.results[0].Polygons);
            }
        }, null, function errCallback(networkStatus, statusMessage) {
            console.log(networkStatus);
            console.log(statusMessage);
        });
    });

    https://msdn.microsoft.com/en-us/library/dn306801.aspx

    entityType

    Required. The entity type to return.

    Note that not all entity types are available for each location.

    A string that contains one of the following the entity types.

    • CountryRegion: Country or region

    • AdminDivision1: First administrative level within the country/region level, such as a state or a province.

    • AdminDivision2: Second administrative level within  the country/region level, such as a county.

    • Postcode1: The smallest post code category, such as a zip code.

    • Postcode2: The next largest post code category after Postcode1 that is created by aggregating Postcode1 areas.

    • Postcode3: The next largest post code category after Postcode2 that is created by aggregating Postcode2 areas.

    • Postcode4: The next largest post code category after Postcode3 that is created by aggregating Postcode3 areas.

    • Neighborhood: A section of a populated place that is typically well-known, but often with indistinct boundaries.

    • PopulatedPlace: A concentrated area of human settlement, such as a city, town or village.

    Try changing entityType:'PopulatedPlace' to entityType: 'AdminDivision2' and see the difference.

    Sincerely,

    IoTGirl



    Friday, September 7, 2018 4:40 PM
    Owner
  • Hi Pranitya,

    As for the Postal Codes, they seem to be working as "PostalCode3"

    https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk/sdsloadmultipleboundaries

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        /* No need to set credentials if already passed in URL */
        center: new Microsoft.Maps.Location(54.896618, -2.936891),
        zoom: 8 });
    //Create an array of locations to get the boundaries of 
    var zipCodes = ['CA1', 'CA2', 'CA3','CA4', 'CA5', 'CA6','CA7','CA8', 'CA9','CA10',
                    'CA11','CA12','CA13','CA14','CA15','CA16','CA17','CA18','CA19','CA20',
                    'CA21', 'CA22', 'CA23', 'CA24','CA25', 'CA26', 'CA27','CA28','CA29'];
    var geoDataRequestOptions = {
        entityType: 'Postcode3'
    };
    Microsoft.Maps.loadModule('Microsoft.Maps.SpatialDataService', function () {
        //Use the GeoData API manager to get the boundary
        Microsoft.Maps.SpatialDataService.GeoDataAPIManager.getBoundary(zipCodes, geoDataRequestOptions, map, function (data) {
            if (data.results && data.results.length > 0) {
                map.entities.push(data.results[0].Polygons);
            }
        }, null, function errCallback(callbackState, networkStatus, statusMessage) {
            console.log(callbackState);
            console.log(networkStatus);
            console.log(statusMessage);
        });
    });

    Sincerely,

    IoTGirl

     

    Friday, September 7, 2018 5:35 PM
    Owner