How to add CSS class to my GeoJSON shapes in Bing Map V8 RRS feed

  • Question

  • Hi,

    My web app under development requires user to select a state and county from dropdownlists. When a county is selected, it loads an array of geojson objects onto the map via Layer.  My base map is aerial.  I want to specify a class to my geojson objects so it stands out on the map.  Right now, I can't tell if they're actually loaded since I don't have fill and stroke colors. 

    I'm using D3.js library to read my geojson data.  This loads okay; no error flags.

    Following is my code snippet for the function that loads the geojson layer:

    function loadGeoJsonLayer(stname, fips) {
            var vCenter = getStateCenter(stname);
            var map = new Microsoft.Maps.Map('#divMap', {
                credentials: bmKey,
                center: new Microsoft.Maps.Location(vCenter[0], vCenter[1]),
                mapTypeId: Microsoft.Maps.MapTypeId.aerial,
                zoom: 12
            var st = getStAbbr(stname);
            d3.json("/data/geo/" + st + "/" + fips + ".json", function (error, data) {
                if (error) throw error;
                var geoShps = data.features;
                var jsonShps = new Array(geoShps.length);
                var coords = new Array(geoShps.length);
                var shape;
                for (var i = 0; i < geoShps.length; i++) {
                    //get coordinates in latitude and longitude
                    coords[i] = [geoShps[i].properties.Latitude, geoShps[i].properties.Longitude];
                    jsonShps[i] = { "id": geoShps[i].properties.FUID, "type": "Polygon", "coordinates": [[coords[i]]], "zIndex": 10000};
                var layer = new Microsoft.Maps.Layer();

    Marilyn Gambone

    Saturday, March 30, 2019 12:08 PM