QGIS Command Line Usage – How to Operate QGIS on Windows

qgisshellwindows

I have QGIS running on a windows operating system.
I am willing to use QGIS from command line to follow this procedure.

Unfortunately, i cannot manage to have qgis declared in the command windows.
I have added "C:\Program Files (x86)\Quantum GIS Lisboa\" to the path variable. but it does not seem to be sufficient.

Would you have any tip on that ?

EDIT

As proposed by Andre Joost, declaring the \bin subdirectory is a first step.
Following procedure, the command I am trying to run is:

 C:\...>qgis --project myproject.qgs --snapshot image.png 
 --width 1500 --height 1000 --extent 831421.30, 6496828.19, 860046.84, 6536520.86

QGIS loads the project and then the cursor freeze/standby. and Qgis answers no more for several minutes and I kill it. the snapshot image.png and companion world file are generated but are empty (7Ko png).

the cmd output is:

_path=C:\PROGRA~2\Quantum GIS Lisboa\apps\Python27\Scripts
OSGEO4W home is C:\PROGRA~2\Quantum GIS Lisboa

END of EDIT

best regard,
Pascal

Best Answer

You have to start qgis.bat, not qgis.exe. The bat is in the \bin subdirectory.

Otherwise the environment variables are not set properly.

If you want to start Qgis from a selfmade batch, you have to use a CALL statement to invoke qgis.bat.


EDIT

I'm afraid you are out of luck with --snapshot:

http://hub.qgis.org/issues/4076

http://hub.qgis.org/issues/7079

It worked with earlier versions of QGIS (when the blog was actually written). I get the same behaviour with Lisboa and Master from last November.

Related Question