<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Salvatore,<br>
      <br>
      Thanks! I'm working on a python class to easily publishing process
      based on PyWPS and QGIS-Processing.<br>
      <br>
      I have updated my script exemple :<br>
      ======================<br>
      #!/usr/bin/env python<br>
      # -*- coding: utf-8 -*-<br>
      <br>
      import sys, os<br>
      import inspect<br>
      <br>
      #first qgis<br>
      from qgis.core import *<br>
      #next PyQt4<br>
      from PyQt4.QtCore import *<br>
      from PyQt4.QtGui import *<br>
      <br>
      # init QApplication for processing and set the customSettingFolder<br>
      #a = QApplication( sys.argv )<br>
      QgsApplication( sys.argv, False, "/my/custom/path" )<br>
      <br>
      # supply path to where is your qgis installed<br>
      QgsApplication.setPrefixPath("/my/build", True)<br>
      <br>
      # load providers<br>
      QgsApplication.initQgis()<br>
      <br>
      p = QgsProject.instance()<br>
      p.read( QFileInfo( "/my/project.qgs" ) )<br>
      print p.title()<br>
      <br>
      mlr = QgsMapLayerRegistry.instance()<br>
      <br>
      qa = QApplication( sys.argv )<br>
      from processing.core.Processing import Processing<br>
      cmd_folder =
      os.path.split(inspect.getfile(inspect.currentframe()))[0]<br>
      if cmd_folder not in sys.path:<br>
          sys.path.insert(0, cmd_folder)<br>
      Processing.initialize()<br>
      <br>
      from processing.tools import *<br>
      #general.alglist( 'znt' )<br>
      <br>
      #general.alghelp( 'modeler:znt' )<br>
      <br>
      paramalg = []<br>
      <br>
      print "runalg start"<br>
      general.runalg( 'process:identifier', *paramalg )<br>
      print "runalg end"<br>
      <br>
      # quit<br>
      QgsApplication.exitQgis()<br>
      #a.exit()<br>
      QApplication.exit()<br>
      ======================<br>
      <br>
      Regards,<br>
      René-Luc D'Hont<br>
      3Liz<br>
      <br>
      Le 02/01/2014 21:52, Salvatore Larosa a écrit :<br>
    </div>
    <blockquote
cite="mid:CANxjxapnYFV8y1ebSV6XGh8=m8HFmVAqKHD1Os4kr_4oeuR_Tg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra"><font><span
              style="font-family:'Helvetica Neue'">Hi, <br>
              <br>
              I just tested it and works wonderfully! <br>
              I also have tried it as web process for PyWPS and works
              very well! <br>
              <br>
              Thanks a lot for this!</span></font><br>
          <br>
        </div>
        <div class="gmail_extra">Best Regards,<br>
        </div>
        <div class="gmail_extra">-SL<br>
        </div>
        <div class="gmail_extra">
          <br>
          <div class="gmail_quote">On Mon, Dec 16, 2013 at 3:46 PM,
            rldhont <span dir="ltr"><<a moz-do-not-send="true">rldhont@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi dev,<br>
              <br>
              I just created a pull request to run QGIS-Processing
              headless.<br>
              I have tested it with a qgis and a modeler algorithm.<br>
              <br>
              <a moz-do-not-send="true"
                href="https://github.com/qgis/QGIS/pull/1031"
                target="_blank">https://github.com/qgis/QGIS/pull/1031</a><br>
              <br>
              Review and comments are welcome<br>
              <br>
              To test QGIS Processing algorithm headlessly, you can use
              this python code<br>
              __________________________________<br>
              <br>
              import sys, os<br>
              import inspect<br>
              <br>
              from PyQt4.QtCore import *<br>
              from PyQt4.QtGui import *<br>
              from qgis.core import *<br>
              <br>
              <br>
              # supply path to where is your qgis installed<br>
              QgsApplication.setPrefixPath("/path/to/your/qgis/build",
              True)<br>
              <br>
              # load providers<br>
              QgsApplication.initQgis()<br>
              <br>
              # load a project<br>
              p = QgsProject.instance()<br>
              p.read( QFileInfo( "/path/to/a/project.qgs" ) )<br>
              <br>
              # init QApplication for processing<br>
              a = QApplication( sys.argv )<br>
              <br>
              # init QGIS Processing<br>
              from processing.core.Processing import Processing<br>
              cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]<br>
              if cmd_folder not in sys.path:<br>
                  sys.path.insert(0, cmd_folder)<br>
              Processing.initialize()<br>
              <br>
              # import QGIS Processing tools<br>
              from processing.tools import *<br>
              <br>
              # print an algorithms search<br>
              general.alglist( 'buffer')<br>
              <br>
              # print an algorithm help<br>
              general.help( 'qgis:fixeddistancebuffer' )<br>
              <br>
              <br>
              # run an algorithm<br>
              alg = Processing.getAlgorithm( 'qgis:fixeddistancebuffer'
              )<br>
              general.runalg( 'qgis:fixeddistancebuffer',
              '/vector/layer/input/uri', 0.1, 5, False,
              '/vector/layer/output.shp' );<br>
              <br>
              # quit<br>
              QgsApplication.exitQgis()<br>
              ____________________________<br>
              <br>
              export PYTHONPATH=/path/to/build/share/qgis/python:/path/to/build/share/qgis/python/plugins<br>
              export LD_LIBRARY_PATH=/path/to/build/lib<br>
              python my_scrpit.py<br>
              _____________________________<br>
              <br>
              Regards<br>
              _______________________________________________<br>
              Qgis-developer mailing list<br>
              <a moz-do-not-send="true">Qgis-developer@lists.osgeo.org</a><br>
              <a moz-do-not-send="true"
                href="http://lists.osgeo.org/mailman/listinfo/qgis-developer"
                target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <br>
          -- <br>
          Salvatore Larosa<br>
          linkedIn: <a moz-do-not-send="true"
            href="http://linkedin.com/in/larosasalvatore"
            target="_blank">http://linkedin.com/in/larosasalvatore</a><br>
          twitter: @lrssvt<br>
          skype: s.larosa<br>
          IRC: lrssvt on freenode<br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>