Hello,
I am facing an issue with ArcGIS Server network service. Whenever I try to solve a route with a barrier point of type 'added-cost', it fails with the following error:
"Point barriers cannot have a field value of BarrierType = \"ScaledCost\"."
According to the documentation, it should be doable:
https://pro.arcgis.com/en/pro-app/latest/help/analysis/networks/barriers.htm
It's also reproductible on ArcGIS Online routing service:
https://codepen.io/NicolasGIS/pen/NWENNPY?editors=100 (copy paste code in RouteLayer sandbox as it requires a token:
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=layers-routelayer
Did I miss anything or does it look like a BUG ?
Thanks,
Nicolas
Hey Nicolas,
For point barrier, you should provide BarrierType as either 0 (Restriction) or 2 (Added Cost). Here is the rest API doc: https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm#GUID-68ECCC15...
Note, for other types of barriers (polyline barrier and polygon barrier), you provide BarrierType as either 0 (Restriction) or 1 (Scaled Cost).
After replacing your code with "barrierType: 2", it runs successfully for me.
Btw, where did you get the syntax of passing "added-cost" to barrierType? That could be a documentation issue if you got it from the doc.
Hello @MaxZeng ,
Thanks for your reply.
I got it from the documentation of ESRI MAPS SDK:
You said it works with integer but if I write:
// create new point barriers
const pointBarriers = [
new PointBarrier({
barrierType: 1,
geometry: { x: -117.30968, y: 34.06493 }
})
];
The following parameter is sent is sent so it is not taken into account:
Thanks,
Nicolas
PS: I may have misplaced this post - it should probably goes to the Maps SDK one.
Hey Nicolas,
The rest API doc specifies that you need to also provide Attr_[Cost] when use added cost barrier and affect result. I am not sure how it can be provided in the SDK. I will check and get back to you.
Max