4

For a certain project I'm required to run QGIS processes on a large data set on a Linux server as my PC does not have the sufficient memory to execute them (snapping points to lines + Steiner tree extraction using national road data).

Is it possible to run QGIS without the aid of its GUI only using the Command Line Interface?

  • I do this on CentOS and Ubuntu Server with XRDP desktop so it creates a desktop experience and allows using Windows RDP. I was able to install QGIS and GRASS. – GeospatialInformationTech Jul 29 '19 at 3:31
2

Assuming you want to use PyQGIS python scripts to automate your workflow, you could do something like the following (roughly based on what I do for automated testing of a QGIS 3 python plugin in my Travis CI setup):

export PREFIX=/usr  # for a standard install, I also use PREFIX=$CONDA_PREFIX if I've installed into an activated conda env
export QT_QPA_PLATFORM=offscreen  # Allow QT/QGIS to run headless
export PYTHONPATH=$PREFIX/share/qgis/python/plugins/processing:$PREFIX/share/qgis/python:$PYTHONPATH
python my_qgis_script.py
| improve this answer | |
  • Hi. Thanks for this. I'm wondering if it will be possible to use the tools available in the QGIS processing toolbox though. – Nandula Jul 29 '19 at 2:33
  • Thank you @user2856 I will give this a try. – Nandula Jul 29 '19 at 2:40
  • I posted this <gis.stackexchange.com/questions/330255/…> which you may find useful. At the bottom of the post is a working example of running completely from the command line outside the application (assumes QGIS3). For running on a server you could tweak it so the input data files are called externally when it runs (e.g. standalone.py inputfile.shp) and then run it using GNU Parallel (assuming you are using Linux) so you can make use of all of the processors/cores on your server. – alanajones Jul 29 '19 at 5:53
2

Starting with the release of QGIS 3.14 there is a real QGIS command line mode to use processing algorithms It's called qgis_process. See the change log and search for the new feature: New standalone console tool for running processing algorithms.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.