There's a bug when loading barriers from a dataset
That because the coordinate y, x in the dataset have many digits father the decimal point.
This code work fine:
var mypoint = new esri.geometry.Point(221967.496, 643632.837, new esri.SpatialReference({ wkid: 2039 }))
addBarrierPoint(mypoint);
But this code cause a error in the api
var mypoint = new esri.geometry.Point(221967.49658284057, 643632.8372346461, new esri.SpatialReference({ wkid: 2039 }))
addBarrierPoint(mypoint);
Walk around:
Instead of load directly from dataset you have to loop .
And round the decimal digits :
function loadBarriers(fset) {
try {
// This line cause a error
// routeParams.barriers = fset;
var mypoint, attr;
var features = fset.features;
for (var i = 0, il = features.length; i < il; i++) {
attr = features.geometry;
mypoint = new esri.geometry.Point(roundNumber(attr.x), roundNumber(attr.y), new esri.SpatialReference({ wkid: 2039 }));
addBarrierPoint(mypoint);
}
}
catch (ex) {
alert("loadBarriers" + ex);
}
}
function roundNumber(num) {
var result = Math.round(num * Math.pow(10, 4)) / Math.pow(10, 3);
return result;
}