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?


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
  • 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 at 2:33
  • Thank you @user2856 I will give this a try. – Nandula Jul 29 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 at 5:53

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.

  • 2
    That's an answer to OP's actual problem but not an answer to the question they asked. Please only post answers to the exact questions. – bugmenot123 Jul 29 at 7:52

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.