Is there a limitation number of facilities for "Find Closest Facilities" API Sample?

826
5
12-02-2011 12:39 PM
ZhengxiWang
New Contributor
I am trying to customize "Find Closest Facilities" (under "Network Analyst") from JavaScript API Samples at http://help.arcgis.com/en/webapi/javascript/arcgis/demos/routetask/routetask_closest_facility.html and I found that it seemed there was a limitation number of facilities. When I used 10 or below facilities, my customized Web application worked well, but if I used over 10 facilities, my customized Web application did not work.

It only showed the point user clicked, but no route was shown. Here is my customized Web application of 6 facilities: http://egis.artsci.uc.edu/wang_fp1201.htm and here is my customized Web application of 38 facilities: http://egis.artsci.uc.edu/wang_fp1202.htm .

Could you please help figure out what is the problem of my Web application? I would appreciate your help a lot!

Thanks for any suggestions!!!
0 Kudos
5 Replies
derekswingley1
Frequent Contributor
There isn't a hard limit on the number of facilities you can use. The problem you're probably having is that using more facilities generates a longer URL. When the API tries to load a URL over 2048 characters, it automatically switches to doing a POST instead of a GET. Doing a POST with a long URL requires a proxy page due to limitations imposed by some browsers. It's pretty straightforward to set up a proxy page. We have instructions on how to do this in the proxy page documentation.
0 Kudos
ZhengxiWang
New Contributor
There isn't a hard limit on the number of facilities you can use. The problem you're probably having is that using more facilities generates a longer URL. When the API tries to load a URL over 2048 characters, it automatically switches to doing a POST instead of a GET. Doing a POST with a long URL requires a proxy page due to limitations imposed by some browsers. It's pretty straightforward to set up a proxy page. We have instructions on how to do this in the proxy page documentation.


I really appreciate you help!
0 Kudos
MarkHoover
Occasional Contributor II
We have the proxy page correctly set up on our site and I still have never gotten this task to work, particularly over long distances.  Is it meant to be a short-range solution?
0 Kudos
derekswingley1
Frequent Contributor
We have the proxy page correctly set up on our site and I still have never gotten this task to work, particularly over long distances.  Is it meant to be a short-range solution?


That's a better question for someone who knows Network Analyst better than me...maybe try the Netowrk Analyst forum? What's the response from your service? Does it time out does it return an error? And are you able to get the same request to work from the services directory?
0 Kudos
StephenLead
Regular Contributor III
Does it time out does it return an error? And are you able to get the same request to work from the services directory?


Assuming you're talking about the sample at http://help.arcgis.com/en/webapi/javascript/arcgis/demos/routetask/routetask_closest_facility.html it returns an error message when you place a point more than a few hundred metres from a facility:

"code":400,"message":"Unable to complete  operation.","details":["No \"Facilities\" found for \"Location 1\" in \"Incidents\".  No solution found


It looks like the sample server at http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Closest%20Facility only contains a small road section around downtown San Francisco - it's designed to demonstrate just this Find Task sample only, I guess.

Cheers,
Steve
0 Kudos