AnsweredAssumed Answered

Add circle areas as barrier

Question asked by pcumino on Aug 9, 2016
Latest reply on Aug 9, 2016 by thejus.kambi

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[i].contextElement.attributes[0].value);           aircondition = aircondition.toString(aircondition);           aircondition = getNumber(aircondition);            if(aircondition >= idealCondition){                var position = JSON.stringify(sensors[i].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

Outcomes