Closed bholtdwyer closed 1 year ago
I should add that if I export small_sample and single_final_command to .gpkg files, load them in the QGIS GUI, and call "Clip", the process finishes in 4.5 seconds. So it's not that there's something about the input data that should make the process stall out. Also, I've run st_make_valid and st_is_valid on both; they both have valid geometries.
Hi @bholtdwyer can you provide a minimal reproducible example? Also the output of sessioninfo::session_info()
, and used QGIS version please. You can use reprex::reprex(session_info = TRUE)
to make this easy. Thanks!
So sorry, I went back this morning and found a bug in my code that was the source of the poor performance. (Can you spot it? Answer in reverse in postscript.) My apologies.
One question: would it be possible to add a global option to the package that makes its functions output sf objects? I do all my other spatial manipulation in R using sf objects, and having to call st_as_sf() on the result of each call to qgisprocess just uglies up the code. (In fact I only recently found out that a qgis_result was coercible to sf.)
Thanks so much for all your work on this! The speed of qgis_clip on my full dataset is currently orders of magnitude faster than the closest sf equivalent, which has made a seemingly slow computation blazingly fast.
P.S. [!eman tnemugra eht ton si "semitn"]
Thanks for your feedback on this @bholtdwyer, great that you have found this yourself. No problem, we're all learning!
would it be possible to add a global option to the package that makes its functions output sf objects
Not all algorithms return a spatial object as part of the qgis_result
, and some return multiple such objects. So this would present pitfalls when trying to generalize across algorithms. The main function qgis_run_algorithm()
best remains robust with a predictable result. You could write your own wrapper function to use in your own scripts though, something like:
myfun <- function(algorithm, ...) {
result <- qgis_run_algorithm(algorithm = algorithm, ...)
st_as_sf(result)
}
Do note however that the more you hide, the harder it will be to debug in case of problems.
Hi! I'm noticing something very strange: when I try running qgis_crop on a large dataset, the code finishes running almost immediately; when I try running it on a small subset of the data to be cropped, the code hangs and does not finish for minutes on end. I have no idea why this should be the case. Example below (I can send the shapefiles I'm using if that would be helpful).
Please let me know if there's anything I can do to be helpful, and thanks so much for making this package available!