Skip to content
mcvittal edited this page Nov 11, 2016 · 5 revisions

Qpy wiki

This wiki will provide code samples and documentation on all processing functions available in the Qpy project to help you get started with writing standalone QGIS python scripts.

Getting started with qpy

Ensuring that qpy is in your system path

If this project is not sitting somewhere in your path, or you just want to be sure your script will execute, add the following lines to your python script at the top/in your python shell:

import sys
sys.path.append("/path/to/qpy/project/folder")

Linux

Start a python2 shell either in the base directory of this Github project or have this module in your system path. Then simply import qpy.

$ python2  
Python 2.7.12+ (default, Sep  1 2016, 20:27:38)  
[GCC 6.2.0 20160822] on linux2  
Type "help", "copyright", "credits" or "license" for more information.  
>>> import qpy  
Initializing qpy for a linux system
>>> 

Running your standalone script would be as simple as doing the following:

$ python2 my_qpy_script.py

Or, if you have your shebang set up properly:

$ ./my_qpy_script.py

Windows

Ensure that you are running an OSGeo4W shell, and execute either python-qgis or python-qgis-ltr, whichever one is available. This library is tested using the ltr Python shell on Windows. The windows version is still under development so it may or may not successfully import qpy.

OSX

OSX is currently not supported due to not having access to Apple products, and most likely will never be supported unless an OSX developer joins the project. Most likely, the linux instructions should work fine but I don't know. I recommend dual-booting a Linux distro or running one in a VM until OSX is "officially" supported.

Tools available

Vector functions
Raster functions

Clone this wiki locally