I need to add circles as avoided areas centred in a specific position.
The function I'm using is addBarrier() as shown below:
function addBarrier() { var eventsArray = []; routeParams.barriers = new esri.tasks.FeatureSet(); for (var i = 0; i < sensors.length; i++) { var aircondition = JSON.stringify(sensors.contextElement.attributes[0].value); aircondition = aircondition.toString(aircondition); aircondition = getNumber(aircondition); if(aircondition >= idealCondition){ var position = JSON.stringify(sensors.contextElement.attributes[1].value); position = position.replace('"', ''); position = position.replace('"', ''); var posArray = position.split(','); var pnt = new esri.geometry.Point(posArray[1],posArray[0],new esri.SpatialReference(6864)); routeParams.barriers.features.push(map.graphics.add(new esri.Graphic(esri.geometry.geographicToWebMercator(pnt), barrierSymbol))); } } }
The addBarrier() function uses the location of the objects called sensor.
Instead of an X symbol to represent the location on the map, a circle with a custom radius, which will be another parameter of the object sensor
You can use polygonBarriers instead of point barriers. Convert the points to polygon by using geometryEngine.buffer function.