How to buffer multiple shapes at once


  • Hi,

    Is it possible to buffer each feature in a feature collection at once?  I have a GeoJson file that I overlay on Bing Maps v8.  Now, I want to buffer each feature in it by 10 or so meters.  The following doesn't work:

        Microsoft.Maps.loadModule('Microsoft.Maps.GeoJson', function () {
            var featureCollection =, { polygonOptions: { fillColor: 'rgba(0, 255, 255, 0.3)' } });            
            //buffer the shapes by 10 meters each
            var bufDist = 10;
            var bufUnits = Microsoft.Maps.SpatialMath.DistanceUnits.Meters;
            var bufCap = Microsoft.Maps.SpatialMath.BufferEndCap.Round;
            Microsoft.Maps.SpatialMath.Geometry.buffer(featureCollection, bufDist, bufUnits, bufCap);
            //reset map view
            var rect = Microsoft.Maps.LocationRect.fromShapes(featureCollection);      
            map.setView({ bounds: rect, padding: 80});

    Also, is it possible to prevent the features from overlaying on top of roads; to instead make features follow the contour of the roads when they're within a certain distance of the roads?  It looks funny when they overlay on top of the roads.

    Appreciate any help/suggestions.

    Marilyn Gambone

    Monday, April 22, 2019 1:38 PM


All replies