How to indicate scaled cost polygon barrier in ArcGIS Runtime .NET

3921
5
07-22-2015 12:44 AM
LinaYap1
New Contributor II

Hi,

I am using ArcGIS Runtime for .NET, 10.2.6, and using LocalRouteTask to execute routing analysis.

I would like to indicate some scaled-cost polygon barriers for routing.

I had created a set of polygon barriers to be added to the route analysis, and then added the following attributes:

- polygonGraphic.Attributes[BarrierType] = 1;

Adding this line do allow me to route across the polygon barriers. Then, to consider the scaled cost, I had tried adding the following attributes (my impedance attribute is "Length"):

- polygonGraphic.Attributes["Attr_Length"] = 2;

- polygonGraphic.Attributes["Length"] = 2;

The returned result, do show a route across the barrier, but I am not sure if the cost were actually considered.

Checking the attributes of the polygonbarriers:

- RouteResult.PolygonBarriers[index].Attributes["AddedCost"] : always an empty dictionary

- RouteResult.PolygonBarriers[index].Attributes["Status"] : always 0

- RouteResult.PolygonBarriers[index].Attributes["BarrierType"] : value=1.

Any advice? Thanks in advance.

5 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi Lina,

It looks like you are taking the right approach, but it would really useful if you could provide a more complete example we can test. Include the data if possible, otherwise we can test against various runtime network datasets.

Cheers

Mike

LinaYap1
New Contributor II

Hi,

I had attached my test code here, but I won't be able to provide the network dataset used.

Also, I had observed that my RouteResult.Routes[0].GetTotalLength(LinearUnits.Meter) is always 0 - might that be the problem to the scaled barrier computation?

Thanks,
Lina

0 Kudos
FreddieGibson
Occasional Contributor III

Hi Michael,

I was asked a question similar to this recently. I also have a ready-to-run application that can display this issue in-house and it leverages our San Diego data for the online/offline routing. Everything appears to work fine when using an Online Routing Service, but when leveraging a LocalRouteTask I've noticed that the Cost attributes always return zero and it appears that the solver is ignoring scaled cost polygons. I've attached the sample I've written.

JasonGraves
New Contributor

We have been experiencing the same issue where LocalRoutes cost attributes always return zero. Calls to Route.GetTotalLength and the property Route.TotalTime return 0. Has there been any resolution for this issue or is there a current bug/ticket I can follow or track. Thanks. Freddie Gibson

0 Kudos
FreddieGibson
Occasional Contributor III

Hi Jason Graves​,

I have logged a bug for this issue and it appears that we will be addressing this issue in a future release. If you have access to Esri Support please log a ticket and we can get you attached to the bug I logged for this issue.

0 Kudos