Hi, I just tested it and works wonderfully! I also have tried it as web process for PyWPS and works very well!
Thanks a lot for this! Best Regards, -SL On Mon, Dec 16, 2013 at 3:46 PM, rldhont <[email protected]> wrote: > Hi dev, > > I just created a pull request to run QGIS-Processing headless. > I have tested it with a qgis and a modeler algorithm. > > https://github.com/qgis/QGIS/pull/1031 > > Review and comments are welcome > > To test QGIS Processing algorithm headlessly, you can use this python code > __________________________________ > > import sys, os > import inspect > > from PyQt4.QtCore import * > from PyQt4.QtGui import * > from qgis.core import * > > > # supply path to where is your qgis installed > QgsApplication.setPrefixPath("/path/to/your/qgis/build", True) > > # load providers > QgsApplication.initQgis() > > # load a project > p = QgsProject.instance() > p.read( QFileInfo( "/path/to/a/project.qgs" ) ) > > # init QApplication for processing > a = QApplication( sys.argv ) > > # init QGIS Processing > from processing.core.Processing import Processing > cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0] > if cmd_folder not in sys.path: > sys.path.insert(0, cmd_folder) > Processing.initialize() > > # import QGIS Processing tools > from processing.tools import * > > # print an algorithms search > general.alglist( 'buffer') > > # print an algorithm help > general.help( 'qgis:fixeddistancebuffer' ) > > > # run an algorithm > alg = Processing.getAlgorithm( 'qgis:fixeddistancebuffer' ) > general.runalg( 'qgis:fixeddistancebuffer', '/vector/layer/input/uri', > 0.1, 5, False, '/vector/layer/output.shp' ); > > # quit > QgsApplication.exitQgis() > ____________________________ > > export PYTHONPATH=/path/to/build/share/qgis/python:/path/to/ > build/share/qgis/python/plugins > export LD_LIBRARY_PATH=/path/to/build/lib > python my_scrpit.py > _____________________________ > > Regards > _______________________________________________ > Qgis-developer mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-developer > -- Salvatore Larosa linkedIn: http://linkedin.com/in/larosasalvatore twitter: @lrssvt skype: s.larosa IRC: lrssvt on freenode
_______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
