Closed diegogentilepassaro closed 3 years ago
Hi, this is an example from issue #3. Ensure the two layers have the same CRS.
vlayer = QgsVectorLayer("D:\\tst\\start.shp", "start", "ogr")
vlayer2 = QgsVectorLayer("D:\\tst\\end.shp", "end", "ogr")
test=processing.run("Cost distance analysis:Least Cost Path", { 'BOOLEAN_OUTPUT_LINEAR_REFERENCE' : False, 'BOOLEAN_FIND_LEAST_PATH_TO_ALL_ENDS':False, 'INPUT_COST_RASTER' : 'D:/tst/cost.tif', 'INPUT_END_LAYER' : vlayer2, 'INPUT_RASTER_BAND' : 1, 'INPUT_START_LAYER' : vlayer, 'OUTPUT' : 'memory:' })
If it still doesn't work, please attach the error log so that we can find the problem. Thanks!
I have run a process through the QGIS GUI and I got the answer I needed. Now I want to make it reproducible and I am trying to implement without success after a couple of hours. Could you please show me an example of code running any least cost path? I have tried the following without luck: