r-spatial / qgisprocess

R package to use QGIS processing algorithms
https://r-spatial.github.io/qgisprocess/
GNU General Public License v3.0
202 stars 20 forks source link

Feature request: function to write Qgis project #223

Open aloboa opened 2 weeks ago

aloboa commented 2 weeks ago

I often do raster and vector processing using package terra and alike. At some point, I need to visualize results in Qgis. As soon as the results imply multiple raster and vector layers, a function to write an ad-hoc Qgis project would be great advantage.

ratnanil commented 6 days ago

This is exactly why I came here ☝🏼 (I literally just tooted this)

The ability to create a QGIS project XML from this package would be an awesome feature 💯

florisvdh commented 6 days ago

Thanks for sharing the enthusiasm :slightly_smiling_face:. Several things are to be considered.

ratnanil commented 6 days ago

Thank you very much for your valuable thoughts on this! Quick question: I can't seem to find anything on the qgis CLI utility you mention, is this documented anywhere?

florisvdh commented 6 days ago

I understand the confusion. I just mean the QGIS executable, which one can call from the command line, and from the command line it can take arguments (files in this case) and options. In a bash environment, its documentation is available with man qgis. I'm not sure whether this documentation is rendered somewhere on the web, but might be.

aloboa commented 2 days ago

As far as I can see, the qgis command line options let the user open the layers, which I have been able to do such as:

qcomm <- paste("qgis", file.path(dirdata, "DI17_2_labels_R.tif"), "./DI17autoseg12/DI17_2_autoseg12.shp", "&")
system(qcomm)

but styling would need to be done through xml "QGIS layer definition files (.qlr)"