Select to view content in your preferred language

how to calculate least cost path between all points

1255
3
10-13-2013 01:58 PM
KatMartin
New Contributor
Hi,
I have a dataset of 34 sites, and need to calculate the least cost path of each site to every other site in the dataset.
I have managed to successfully run a model, however because I am using the same site input file for both site origin and site destination, the least cost path is each site to itself.
Is there a quick way to tell arcgis to not calculate the distance of a site to itself?
I am using arcgis 10.1.
Any help would be greatly appreciated, as I don't want to create 33 dummy destination files, with each origin point removed.
Thanks,
Kat
0 Kudos
3 Replies
XanderBakker
Esri Esteemed Contributor
Hi,
I have a dataset of 34 sites, and need to calculate the least cost path of each site to every other site in the dataset.
I have managed to successfully run a model, however because I am using the same site input file for both site origin and site destination, the least cost path is each site to itself.
Is there a quick way to tell arcgis to not calculate the distance of a site to itself?
I am using arcgis 10.1.
Any help would be greatly appreciated, as I don't want to create 33 dummy destination files, with each origin point removed.
Thanks,
Kat



Hi Kat,

It sounds to me that you could solve this by using an iterator to loop over field values. In that case you would be executing your model several times, with only changing source and destinations.

Suppose you have a field with unique values (1 - 34) of your sources/destinations, then you can use the 'Iterate Field Values' for 33 times (skip the last). Each iteration will give you the value of a single source. By using this value in the definition query (UniqueValue = iterationValue) of the tool 'Make Feature Layer (Data Management)' you can create a source layer (not a physical file) that only contains this single location. Use the Make Feature Layer tool again with a different definition query (UniqueValue > iterationValue) to create the destination layer. Execute the cost distance with these layers.

Some reading on iterators:
A quick tour of using iterators
Examples of using iterators in ModelBuilder


Kind regards,

Xander
0 Kudos
AshleyManning
Deactivated User
Hi Kat,

It sounds to me that you could solve this by using an iterator to loop over field values. In that case you would be executing your model several times, with only changing source and destinations.

Suppose you have a field with unique values (1 - 34) of your sources/destinations, then you can use the 'Iterate Field Values' for 33 times (skip the last). Each iteration will give you the value of a single source. By using this value in the definition query (UniqueValue = iterationValue) of the tool 'Make Feature Layer (Data Management)' you can create a source layer (not a physical file) that only contains this single location. Use the Make Feature Layer tool again with a different definition query (UniqueValue > iterationValue) to create the destination layer. Execute the cost distance with these layers.

Some reading on iterators:
A quick tour of using iterators
Examples of using iterators in ModelBuilder


Kind regards,

Xander


Hi Xander,

Could you please expand on what you mean by the "definition query" of the Make Feature Layer tool? Also, should this tool be input into the model or should the temporary field be created beforehand?

Thank you,

Ashley Manning
0 Kudos
curtvprice
MVP Alum
Could you please expand on what you mean by the "definition query" of the Make Feature Layer tool?


He means the where_clause parameter.

Also, should this tool be input into the model or should the temporary field be created beforehand?


This tool would be used inside your model, run for each iteration. In ModelBuilder the expression would be something like:

"SITEID" = '%value_element_name%'

where value_element_name is from the output of the iterator tool.

The help links Xander mentioned have some good examples.
0 Kudos