I am trying to run my QGIS model inside R using the qgisprocess
package.
The model gets a raster and vector line inputs. Its output is an attribute-only QGIS table.
Here is the model diagram in QGIS
Here is the code I am using in R:
library(qgisprocess)
library(sf)
library(terra)
# load data
elevation <- rast(DEM_RW_UTM36S.tif"))
route <- st_read("Distances.gpkg", layer = "lines")
# run the model
result <- qgis_run_algorithm(
algorithm = "model:Route_slope_assessment",
dem = elevation,
route = route,
.quiet = FALSE
)
I am getting an error with the message:
ERROR: The following mandatory parameters were not specified
slopes: slopes
My issue is that when I add the slopes
parameter as indicated in this message and supply it with a path to a csv file to create, then I get an error that that the supplied "slopes" argument is unused.
I have verified that this algorithm is available in qgisprocess.
Using qgis_show_help("model:Route_slope_assessment")
shows that the model expects an additional parameter called route_slope_analysis
of type sink
. I don't know what this argument is or how to specify it.
What is the proper way to specify this model output and read it back into R as a dataframe?
Have you tried using the UI and putting in the values manually and looking at the 'Advanced' button to see the suggested output? This could help you alot to figure out the required input you need in qgis_run_algorithm()
The output is something like this, and you can figure out how to amend your code
processing.run("native:deletecolumn", {'INPUT':'C:/projects/phoenix/shape/master_list2.parquet|layername=master_list2','COLUMN':['lvl3_area_name'],'OUTPUT':'TEMPORARY_OUTPUT'})