0

I have 2 sets of locations represented by two point shapefiles in ArcGIS 10.1. My aim is to calculate the least cost path from each source location (let's call it A) to the destination locations (let's call them B) implementing the Tobler's hiking function and using ArcGIS path distance and cost path tools, as described for instance in this site:

http://www.mapaspects.org/node/3744

When it comes to calculating the least-cost path between just one A and all the Bs, I have no problem. But, since the procedure has to be repeated n times, being n equal to the number of As location, I am badly wondering if there is any way in ArcGIS to automate the procedure.


I tried to follow @Sam3000's very useful suggestion. I built a main model containing the Path Distance and the Cost Path tools (see attached image), and two submodels (nested into the main model) each iterating feature selection on the origin and destination locations respectively. But arcgis returns "ERROR 000581: Invalid parameters. Failed to execute (Path Distance).enter image description here. Now, from what I can hypothesize looking at what happen when I run the whole model, is that arcGIS is first running the first submodel (Submodel_origin; bottom-left in the attached image) on its own, that is without passing its output (row-by-row) to the Path Distance tool (which is part of the main model). Maybe, there is setting that I am missing as to the way in which the operations performed by the different chunks must related to each other.

What this model should do in principle, as I have conceived it, is:

  1. selecting an origin location at time (submodel_origin);
  2. passing it to the Path Distance tools (which also takes as inputs a DEM and a SLOPE raster);
  3. step 2 should provide two rasters (namely, an anisotropic raster and a backlink raster) that with be feed into the Cost Path tool;
  4. along with the 2 rasters in the previous step, another submodel (Submodel_destination) should select one destination location at time to be feed into step (3);
  5. the output of the Cost Path is then converted into a polyline feature.
2

I recently came up against a very similar challenge and produced the model below using ArcGIS ModelBuilder. Model

The key part here is the "Iterate Feature Selection" element. It will output each of the source points one at a time as a selection, which you can then turn into an individual feature class using copy features (as I have done) if you wish, or simple carry out the operation on the selection. In this case I am performing a Path Distance analysis, however you could easily perform a Cost Path Analysis instead.

Your Challenge

Your task would require you to iterate through both sources and destinations, which would require intigrating an almost identical model to iterate through destination points as the primary model goes through the source points, see here for more.

Finally, do consider right clicking on the tool you wish to use and choosing "Batch", which allows you to run the same tool many times over without interaction. It does still require quite a bit of setting up however, so I prefer model builder myself, but for one tool it is worth considering, here is an example for using "Clip":

enter image description here

  • Thanks for pointing out to me those tricks. I managed to put the "Iterate Feature Selection" to work on the origin locations. In this way, arcGIS goes trough the origin locations, reading them one by one from the origin locations' attribute table, and then calculate the least-cost path from each origin to multiple destinations. Now, as you have anticipated in your reply, I would like to do the same selection relative to the destination locations. This entails using 2 Iterate Feature Selection routines which is not possible within the same model. – NewAtGis Feb 21 '17 at 14:42
  • I have build a main model containing the Path Distance and the Cost Path tools, and two submodels (nested into the main model) each iterating feature selection on the origin and destination locations respectively. But arcgis returns "ERROR 000581: Invalid parameters. Failed to execute (Path Distance)." Maybethere is something wrong with the nesting itself. On the other hand, it seems that the outputs of the submodel are properly fed into (as input) in the Path Distance and Cost Path tools. If I find a way to attach a picture of my model, I will post it. – NewAtGis Feb 21 '17 at 14:46
  • You can Export your model(s) as an image from the "File" menu in the top left, you can then edit your question to add it. It may be easier to use python to do this if you are comfortable to consider that, I would be quite happy to write example code for you to use – Sam3000 Feb 22 '17 at 15:05

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.