none
Bing Map - County Observation RRS feed

  • Question

  • Hi All,

    We're using following code from interactive SDK to find boundaries for county region: 

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        credentials: 'Your Bing Maps Key',
        center: new Microsoft.Maps.Location(47.614, -122.165),
        zoom: 11
    });
    //Create an array of locations to get the boundaries of 
    var zipCodes = ['Houston, TX, USA'];
    var geoDataRequestOptions = {
        entityType: 'AdminDivision2'
    };
    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);
            }
        });
    });


    When we use text 'Houston' to plot county in Texas state, it gives boundary for Houston City rather than County but upon using text 'Houston County', it gives accurate boundaries. 

    Could anyone please help me understanding the logic behind this. If it doesn't find exact county name in first place, does it search in City / State or how does this is working? 

    Thank You for your help!

    Saturday, July 15, 2017 10:52 AM

Answers

  • Your location input is passed through a geocoder and the coordinates of the first result is used to find an intersecting polygon of the specified entity type. Your input is Houston Texas which will geocode to the city and this its coordinates used. Try changing your input to Houston county, texas

    [Blog] [twitter] [LinkedIn]

    Saturday, July 15, 2017 3:59 PM