Closed Robinlovelace closed 4 years ago
Final thing to say on this: It did that for 500k lines in ~5 min 🤯 (the R implementation was going to take around 10 hr). So your amazing work on this project is already yielding real world benefits. Many thanks @paleolimbot (and @jannes-m for first demonstrating access to GRASS/SAGA/other algorithms via QGIS from R)!
Sorry I've been MIA on this! I too got unrelated errors for a bit because Python or some plugins weren't loading, which I think was fixed in QGIS. It looks like that plugin is making the assumption that there is a mapCanvas, which in headless mode, there won't be. I don't know if there's a way to address that here...I think that QGIS output will always be noisy and should stay that way (or be totally silenced using silent = TRUE
). I suppose there could be another level of verbosity that suppresses the stderr output but leaves the stdout bit?
I suppose there could be another level of verbosity that suppresses the stderr output but leaves the stdout bit?
Yes maybe. It's a minor issue and was wondering if it's more a local install issue or even an issue for the QGIS issue tracker. Clearly not a priority and a minor issue, just reporting out of interest more than anything, can leave open or close as a "won't fix" but useful for others to know about this 'feature' that may affect different QGIS installations differently, seemingly depending on the plugins installed. Related question: can qgis_run_algorithm()
be used to run plugins that are subsequently installed by the user? I imagine so, could be one to document if anyone gets it working - the sDNA plugin would be my use case but AFAIK the plugin only works on QGIS 2 still (heads-up collaborator and developer of sDNA spatial network analysis software @fiftysevendegreesofrad FYI this may be a way for more people to easily access sDNA from a command line environment and integrate with R).
I think that this particular issue is a plugin-specific (shapetools plugin) issue rather than a QGIS issue if you were to file one somewhere.
I'm pretty sure that starting with QGIS 3.16, the list of plugins loaded when you open the QGIS GUI will be the same as when you run qgis_process
. It probably worked before too, but I think there's a PR that made it more reliable in headless mode recently.
I'll close the issue but as always open a new one if it shows up again and there's something that we can change here to make it better!
Reasonable solution. On the question of running functionality in plugins with qgisprocess
, any ideas? Would be good to have a concrete use case which I currently lack.
I think that all providers except "native" and "3d" are already Python plugins whose algorithms can be run using qgis_process
. You could find another plugin that adds algorithms and see if they show up in qgis_algorithms()
?
You could find another plugin that adds algorithms and see if they show up in
qgis_algorithms()
?
Good plan, will aim to document what I find.
Apologies for raising two issues in one 'issue' but think they may be related.
[x] There are error messages about plugins that are unrelated to QGIS algorithms (see message about shapetools), do these affect the results and is there a way to turn these off?
[x] The algorithm to split lines does not produce the result I was expecting (a multilinestring of 500 m substrings) - this may well be an issue with the QGIS implementation or my understanding of it based on the description here: https://docs.qgis.org/testing/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#id211
(OK, the first issue is fixed with the following updated algorithm - I think this is a great use case):
That works but I get this rather verbose error message, despite the fact that the code runs:
Full reprex below...
Reproducible example that I hope is of use:
Created on 2020-10-27 by the reprex package (v0.3.0)