Least Cost Path - I cannot get to work.

175 views
Skip to first unread message

Dr. Ian Smith

unread,
Sep 8, 2021, 5:50:31 AM9/8/21
to WhiteboxTools
I am researching at a University on possible migration paths for 4 million year old hominins (our ancestors).
Least Cost Path is a tool I’m playing with and have used SAGA/etc to date.
I feel that the Whitebox tool set might offer me considerably greater flexibility and versatility but………………………I am having problems using it (vis QGIS).
I believe I have it correctly set up in QGIS - other tools seem to work OK.
I have all my files prepared; and functioning within GRASS/GDAL/SAGA/etc. But I’m clearly not understanding the process required within Whitebox…..I am well aware I have not fully grasped something.
I have the full manual.
I have the lecture document from John Lindsay (https://jblindsay.github.io/WhiteboxTutorials/LCPAnalysis/lcpa.html#/1 ) – yet still I am stuck.

Are there any ways I can acquire some assistance in carrying out such path analysis?

Is there a basic course I can sign up to?

For example I’m analysing the path from a single point to a single point. In QGIS, those points are vector files. Am I correct that these single points need to be raster files in Whitebox? ( ‘input source file’ and ‘input destination file’ )


Many thanks for your time.

Jean-François Bourdon

unread,
Sep 9, 2021, 9:33:57 PM9/9/21
to WhiteboxTools
The tutorial you are linking to uses Whitebox GAT which not the same as WhiteboxTools. The former is no longer developed and cannot be used via QGIS, but the latter can. Many tools from Whitebox GAT have been ported to WhiteboxTools but sometime the way to use them can be different.

In your case, I suppose you are looking to use CostDistance and CostPathway tools from WhiteboxTools. You first need to run CostDistance with one raster containing your source (any non-zero positive value) and one raster containing the cost of going across each cell (a cell with value 2 will cost double of a cell with value 1). The output backlink raster generated can then be used with CostPathway along with a raster containing the destination cells (any non-zero positive value). The output cost pathway raster file generated will show you the least cost pathway between your source and destination.

Hope this help a bit

Dr. Ian Smith

unread,
Sep 10, 2021, 3:43:08 AM9/10/21
to WhiteboxTools
That is very useful - thanks Jean.
When I construct LCP in SAGA/GRASS, the start and end points are single points in 2 separate vector files. For WhiteBoxTools I have a source raster file with a single pixel (in a large tiff file). I cannot get this to work. Must there be a multitude of (non-zero) pixels for this to work?
Thanks again.

Whitebox Geospatial Inc

unread,
Sep 10, 2021, 5:57:23 AM9/10/21
to Dr. Ian Smith, WhiteboxTools
Hello Ian,

In WhiteboxTools’ LCP you need to specify the Source Point (as an input raster) during the initial CostDistance operation and then the Destination Point (again a raster input) is specified during the subsequent CostPathway operation.

Regards,

John

-- 
You received this message because you are subscribed to the Google Groups "WhiteboxTools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to whiteboxtool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/whiteboxtools/9149b0cd-1962-4893-9ed1-68c42a369cb7n%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dr. Ian Smith

unread,
Sep 24, 2021, 2:59:10 PM9/24/21
to WhiteboxTools
Apologies guys, but I'm clearly not understanding this.
I'm used to using a vector file as the source file (GRASS/etc), but how do I actually " specify the Source Point (as an input raster) ".
I have a single pixel (100m x 100m) with any value in a large 200km x 200 km raster file???????? Where the other pixels are all no value? That is my input raster?
Thanks again.

Brian Kielstra

unread,
Sep 27, 2021, 4:29:17 PM9/27/21
to WhiteboxTools

Hello Ian,

From your posts it looks like you had 1) a vector source point, 2) a vector destination point, and 3) a cost raster. Everything should be spatially aligned for this to work. I haven't run this myself but I would guess the workflow looks like this:

You would need to convert your two vector points to raster using VectorPointsToRaster using your cost raster as the base. Make sure these points have values >0. I don't think that other pixels should be NoData. It says in the WhiteboxTools manual that "NoData values in the input cost surface image are ignored during processing and assigned NoData values in the outputs" but I'm not exactly sure what would happen if all non-source/destination were NoData. Best to set them to 0 based on my reading of the tools.

Use your VectorPointsToRaster-->source point as the source point in CostDistance. Use the CostDistance-->backlink outlook and VectorPointsToRaster-->destination point raster in CostPathway.

The output should be the least cost pathway according to your cost raster. 

I think in communities like this it helps to state what you have tried and what you have come up with as an output. It could be as simple as the spatial alignment is off. The WhiteboxTools Manual is pretty comprehensive otherwise.

Brian 

Dr. Ian Smith

unread,
Sep 28, 2021, 7:09:38 AM9/28/21
to WhiteboxTools
Hello Brian,

I've finally got it.............thank you very much indeed.
I anticipate this tool gives me more versatility in calculating LCPs given the non-homo sapien nature of my migrating species. I can develop far more detailed cost rasters.
I agree, the Manual is pretty comprehensive. I think the issue for those of us new to the technology is that it takes a long time to acquire the GIS language/vocabulary.
BTW, it would appear that I get the same result regardless of whether the source/destination files have zeros or nodata.

Thanks again. Much appreciated.
Message has been deleted

John Lindsay

unread,
Nov 28, 2021, 10:16:10 AM11/28/21
to Dr. Ian Smith, WhiteboxTools
“Expertise on this software seems in short supply :-). Is there a course anywhere????”

I’m not sure that I would agree with this statement Ian. Over the past several months, you’ve asked numerous questions regarding least-cost pathway analysis and have received answers from at least three WBT experts. 

We are constantly working to improve the user-facing documentation for WBT. I’m quite proud of our user manual, of which I have poured innumerable hours into refining. The feedback that I receive on the manual is always positive. We have been releasing YouTube videos over the past several months to help with common WBT topics. We are also planning the release of a number of geomorphometry and remote sensing related laboratory materials to provide in-depth training on specific WBT workflows/tasks in the coming months. I have known of people in the community who have taught WBT workshops, and it’s quite possible that I will teach one in the future as well. However, the amount of time that I have to provide individualized user support is limited. I do my best, but the purpose of the Google Groups forum is to provide users an opportunity to help other users, and I’d say, in light of the responses that you’ve received here since September, that this has largely been successful. 

WBT is a comparably small open-source project and resources are always limited. With the advent of Whitebox Geospatial Inc, we are doing our best to improve the learning resources around the software platform as much as possible and I am personally very proud of what we have accomplished in the past year.

Regards,

John

On Nov 28, 2021, at 9:34 AM, Dr. Ian Smith <driangeo...@gmail.com> wrote:

Expertise on this software seems in short supply :-).
Is there a course anywhere????

Reply all
Reply to author
Forward
Message has been deleted
0 new messages