1

I have a program that displays this path when I give it two points shown by the red marker.

enter image description here

I wanted to create a barrier on that road so I added this code

        Polygon po=new Polygon();
        Point p1=new Point(4102363.9071817156,857772.619643);
        Point p2=new Point(4102416.5557467686,857799.2401230272);
        Point p3=new Point(4102436.1589281,857744.31787604);
        po.startPath(p1);
        po.lineTo(p2);
        po.lineTo(p3);
        Graphic ba_gr=new Graphic(po,null);
        NAFeaturesAsFeature na=new NAFeaturesAsFeature();
        na.addFeature(ba_gr);
        params.setPolygonBarriers(na);

params is my RouteParameters

On my previous code but my program still shows be the previous path. Did I miss something when creating the barriers?

The polygon is in this position,

enter image description here

I tried it on another program.

1

The problem was i was not setting the barrier spatial reference the same as the map's spatial reference

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.