Select to view content in your preferred language

RouteTask Closest Facility

808
2
03-25-2014 09:08 AM
jaykapalczynski
Honored Contributor
Looking at this example and had a few questions.

https://developers.arcgis.com/javascript/jssamples/routetask_closest_facility.html


1.  I see that it is creating 5 square graphics to route against.  How do I add my own Service here

2.  I dont see how the routing is referencing the Square Graphics added (would like to change this to my own point feature)

3.  Is there anything else I would have to configure on my server?

4.  Do I need to create my own proxy?

urlUtils.addProxyRule({
        urlPrefix: "route.arcgis.com",  
        proxyUrl: "/sproxy"
      });


closestFacilityTask = new ClosestFacilityTask("http://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World");

      registry.byId("numLocations").on("change", function() {
        params.defaultTargetFacilityCount = this.value;
        clearGraphics();
      });
0 Kudos
2 Replies
ManishkumarPatel
Deactivated User
Hi Jay,

1.  I see that it is creating 5 square graphics to route against.  How do I add my own Service here
    The square graphics are being created using the symbols,

var incidentPointSymbol = new SimpleMarkerSymbol(
          SimpleMarkerSymbol.STYLE_CIRCLE,
          16,
          new SimpleLineSymbol(
            SimpleLineSymbol.STYLE_SOLID,
            new Color([89,95,35]), 2
          ),
          new Color([130,159,83,0.40])
        ); 
For adding your own service you will have to publish a network analyst service.

Refer the below link for more details:
http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000002pn000000


2.  I dont see how the routing is referencing the Square Graphics added (would like to change this to my own point feature)
The square graphics that are added using the below line of code:

        facilitiesGraphicsLayer.add(new Graphic(new Point(-13625960,4549921,map.spatialReference)));
        facilitiesGraphicsLayer.add(new Graphic(new Point(-13626184,4549247,map.spatialReference)));
        facilitiesGraphicsLayer.add(new Graphic(new Point(-13626477,4549415,map.spatialReference)));
        facilitiesGraphicsLayer.add(new Graphic(new Point(-13625385,4549659,map.spatialReference)));
        facilitiesGraphicsLayer.add(new Graphic(new Point(-13624374,4548254,map.spatialReference)));
        facilitiesGraphicsLayer.add(new Graphic(new Point(-13624891,4548565,map.spatialReference)));

You can change this as per your requirement.

3.  Is there anything else I would have to configure on my server?

You can refer to the help document, if you face any issue while configuring the server.

4.  Do I need to create my own proxy?

You can configure your own proxy. Please refer to the below link:
https://developers.arcgis.com/javascript/jshelp/ags_proxy.html

Hope this helps.

Regards,
Manish
0 Kudos
jaykapalczynski
Honored Contributor
Thank you ... will get t his going... see how things go...will be in touch..

Thank you again...appreciated.
0 Kudos