eduardosilverio1990

myalgorithm.py

Jan 5th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. from qgis.core import QgsApplication
  2. from processing.core.Processing import Processing
  3. from processing.tools import general
  4.  
  5. from pywps.Process import WPSProcess  
  6. from types import StringType
  7.  
  8. class Process(WPSProcess):
  9.      def __init__(self):        
  10.          WPSProcess.__init__(self,
  11.               identifier       = "myalgorithm",
  12.               title            = "Title",
  13.               version          = "1",
  14.               storeSupported   = "false",
  15.               statusSupported  = "false",
  16.               abstract         = "Abstract....")   
  17.          
  18.          self.result = self.addLiteralOutput(identifier = "result", title = "result", type = StringType)
  19.  
  20.      def execute(self):
  21.          qgis = QgsApplication([], False)
  22.          qgis.setPrefixPath("C:/Program Files/QGIS 2.18/apps/qgis", True)
  23.          qgis.initQgis()
  24.          # Processing.initialize()
  25.          # general.runalg('qgis:extractnodes', 'C:/river.shp', 'C:/output.shp')
  26.          qgis.exitQgis()
  27.          self.result.setValue("End")
Advertisement
Add Comment
Please, Sign In to add comment