Processing step is ignored in QGIS3 standalone python script The 2019 Stack Overflow Developer...

How to translate "being like"?

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

How can I define good in a religion that claims no moral authority?

What information about me do stores get via my credit card?

A word that means fill it to the required quantity

What do I do when my TA workload is more than expected?

Why didn't the Event Horizon Telescope team mention Sagittarius A*?

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

Match Roman Numerals

writing variables above the numbers in tikz picture

Correct punctuation for showing a character's confusion

What does Linus Torvalds mean when he says that Git "never ever" tracks a file?

How do PCB vias affect signal quality?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

How to type a long/em dash `—`

Geography at the pixel level

Ubuntu Server install with full GUI

If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?

Mathematics of imaging the black hole

Loose spokes after only a few rides

Can we generate random numbers using irrational numbers like π and e?

How to charge AirPods to keep battery healthy?

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

Are spiders unable to hurt humans, especially very small spiders?



Processing step is ignored in QGIS3 standalone python script



The 2019 Stack Overflow Developer Survey Results Are InFailed to create memory layers in QGIS application on Linuxhow to load the QGIS openlayers_plugin in standalone python script (not the QGIS embedded python console)Loading Oracle Spatial Layers in standalone python qgisPyQGIS couldn't import processing with standalone scriptWorking Windows Standalone .EXE From QGIS Python Script Using PyInstaller?if __name__==“main”: in standalone Python script for QGISProblem executing Processing Vector Grid algorithm in a standalone scriptWhich python version for standalone script with Qgis moduleQGIS Distance Matrix execution failsQGIS3 Creating spatial index in a standalone script as a part of output vector layerImporting QGIS3 processing tools in standalone script





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







2















In my python script based on Qgis 3.0.3-Girona, the processing.run() is completely ignored. There are similar questions that are marked as duplicate - but those do not address or solve the issue that I list here. Here is my script.... *



from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
from qgis.core import QgsApplication
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
sys.path.append('e:\QGIS3\apps/Qt5\plugins')
sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")
params = {
'INPUT_RASTER':'E:\arp\LEAP\s823_actfilt.tif',
'RASTER_BAND':1,
'INPUT_VECTOR':'E:\arp\LEAP\test.shp',
'COLUMN_PREFIX':'actfilt_',
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params,feedback)
print("Finished zonalstats")


*
The output prints "Starting zonalstats" ; "Finished importing" but never prints "Finished zonalstats". I tried several combinations including capturing the output to res variable etc. (as explained in other similar posts) but none of them work - the processing.run() is simply ignored. Not sure if it is a bug or something I'm doing wrong.










share|improve this question














bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Capitalize the 'p' in Processing.run

    – geodranic
    Jun 7 '18 at 17:26


















2















In my python script based on Qgis 3.0.3-Girona, the processing.run() is completely ignored. There are similar questions that are marked as duplicate - but those do not address or solve the issue that I list here. Here is my script.... *



from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
from qgis.core import QgsApplication
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
sys.path.append('e:\QGIS3\apps/Qt5\plugins')
sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")
params = {
'INPUT_RASTER':'E:\arp\LEAP\s823_actfilt.tif',
'RASTER_BAND':1,
'INPUT_VECTOR':'E:\arp\LEAP\test.shp',
'COLUMN_PREFIX':'actfilt_',
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params,feedback)
print("Finished zonalstats")


*
The output prints "Starting zonalstats" ; "Finished importing" but never prints "Finished zonalstats". I tried several combinations including capturing the output to res variable etc. (as explained in other similar posts) but none of them work - the processing.run() is simply ignored. Not sure if it is a bug or something I'm doing wrong.










share|improve this question














bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • Capitalize the 'p' in Processing.run

    – geodranic
    Jun 7 '18 at 17:26














2












2








2


1






In my python script based on Qgis 3.0.3-Girona, the processing.run() is completely ignored. There are similar questions that are marked as duplicate - but those do not address or solve the issue that I list here. Here is my script.... *



from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
from qgis.core import QgsApplication
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
sys.path.append('e:\QGIS3\apps/Qt5\plugins')
sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")
params = {
'INPUT_RASTER':'E:\arp\LEAP\s823_actfilt.tif',
'RASTER_BAND':1,
'INPUT_VECTOR':'E:\arp\LEAP\test.shp',
'COLUMN_PREFIX':'actfilt_',
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params,feedback)
print("Finished zonalstats")


*
The output prints "Starting zonalstats" ; "Finished importing" but never prints "Finished zonalstats". I tried several combinations including capturing the output to res variable etc. (as explained in other similar posts) but none of them work - the processing.run() is simply ignored. Not sure if it is a bug or something I'm doing wrong.










share|improve this question














In my python script based on Qgis 3.0.3-Girona, the processing.run() is completely ignored. There are similar questions that are marked as duplicate - but those do not address or solve the issue that I list here. Here is my script.... *



from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)
from qgis.core import QgsApplication
# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False)
qgs.initQgis()
# Append the path where processing plugin can be found
sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
sys.path.append('e:\QGIS3\apps/Qt5\plugins')
sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")
params = {
'INPUT_RASTER':'E:\arp\LEAP\s823_actfilt.tif',
'RASTER_BAND':1,
'INPUT_VECTOR':'E:\arp\LEAP\test.shp',
'COLUMN_PREFIX':'actfilt_',
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params,feedback)
print("Finished zonalstats")


*
The output prints "Starting zonalstats" ; "Finished importing" but never prints "Finished zonalstats". I tried several combinations including capturing the output to res variable etc. (as explained in other similar posts) but none of them work - the processing.run() is simply ignored. Not sure if it is a bug or something I'm doing wrong.







qgis python standalone






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 4 '18 at 16:13









ap_gisap_gis

213




213





bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • Capitalize the 'p' in Processing.run

    – geodranic
    Jun 7 '18 at 17:26



















  • Capitalize the 'p' in Processing.run

    – geodranic
    Jun 7 '18 at 17:26

















Capitalize the 'p' in Processing.run

– geodranic
Jun 7 '18 at 17:26





Capitalize the 'p' in Processing.run

– geodranic
Jun 7 '18 at 17:26










1 Answer
1






active

oldest

votes


















1














Well, the issue turned out to be a minor one. I had failed to include "import processing". I post below the code that works. Also note that QGIS3 is rather quirky about the paths - the ones recommended in the documentation is not sufficient...hence my code goes overboard in including all - and hence it works. Also make sure you run the file with python3 (the default python is still python 2.7.5 in Qgis3). Hope this helps some who want to run standalone pyQGIS scripts in Qgis 3.



import sys, os
cwd = os.getcwd().replace("\","/")

InVecFile = cwd+"/"+sys.argv[1] # Input vector/polygon file
InRasFile = cwd+"/"+sys.argv[2] # Input raster file
inx = sys.argv[2].split(".")
InPrefix = inx[0]+"_"

if len(sys.argv) < 2:
print("USAGE: qgis3_ZonalStats.py <InVecFile> <InRasFile>")
sys.exit()

from qgis.core import (
QgsApplication,
QgsProcessingFeedback,
QgsVectorLayer
)

from qgis.core import QgsApplication

# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
qgs = QgsApplication([], False, None)
qgs.initQgis()

# Append the path where processing plugin can be found
sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
sys.path.append('e:\QGIS3\apps/Qt5\plugins')
sys.path.append('e:\QGIS3\apps\qgis\python')
sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
sys.path.append('E:\Qgis3\apps\Python36\DLLs')
sys.path.append('E:\Qgis3\apps\Python36\lib')
sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32')
sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32\lib')
sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\Pythonwin')
sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
# Append location of DLLs to current system PATH envrionment variable
# os.environ['PATH'] += r";C:Program FilesQGIS 2.14appsqgis-ltrbin;"

import processing
from processing.core.Processing import Processing
Processing.initialize()
print("Finished importing")

# You can see what parameters are needed by the algorithm
# using: processing.algorithmHelp("qgis:union")
params = {
'INPUT_RASTER':InRasFile,
'RASTER_BAND':1,
'INPUT_VECTOR':InVecFile,
'COLUMN_PREFIX':InPrefix,
'STATS':[0,1,2],
}
feedback = QgsProcessingFeedback()
print("Starting zonalstats")
processing.run("qgis:zonalstatistics", params)
QgsApplication.exitQgis()
app.exit()





share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "79"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f285150%2fprocessing-step-is-ignored-in-qgis3-standalone-python-script%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Well, the issue turned out to be a minor one. I had failed to include "import processing". I post below the code that works. Also note that QGIS3 is rather quirky about the paths - the ones recommended in the documentation is not sufficient...hence my code goes overboard in including all - and hence it works. Also make sure you run the file with python3 (the default python is still python 2.7.5 in Qgis3). Hope this helps some who want to run standalone pyQGIS scripts in Qgis 3.



    import sys, os
    cwd = os.getcwd().replace("\","/")

    InVecFile = cwd+"/"+sys.argv[1] # Input vector/polygon file
    InRasFile = cwd+"/"+sys.argv[2] # Input raster file
    inx = sys.argv[2].split(".")
    InPrefix = inx[0]+"_"

    if len(sys.argv) < 2:
    print("USAGE: qgis3_ZonalStats.py <InVecFile> <InRasFile>")
    sys.exit()

    from qgis.core import (
    QgsApplication,
    QgsProcessingFeedback,
    QgsVectorLayer
    )

    from qgis.core import QgsApplication

    # See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
    QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
    qgs = QgsApplication([], False, None)
    qgs.initQgis()

    # Append the path where processing plugin can be found
    sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
    sys.path.append('e:\QGIS3\apps/Qt5\plugins')
    sys.path.append('e:\QGIS3\apps\qgis\python')
    sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
    sys.path.append('E:\Qgis3\apps\Python36\DLLs')
    sys.path.append('E:\Qgis3\apps\Python36\lib')
    sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32')
    sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32\lib')
    sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\Pythonwin')
    sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
    # Append location of DLLs to current system PATH envrionment variable
    # os.environ['PATH'] += r";C:Program FilesQGIS 2.14appsqgis-ltrbin;"

    import processing
    from processing.core.Processing import Processing
    Processing.initialize()
    print("Finished importing")

    # You can see what parameters are needed by the algorithm
    # using: processing.algorithmHelp("qgis:union")
    params = {
    'INPUT_RASTER':InRasFile,
    'RASTER_BAND':1,
    'INPUT_VECTOR':InVecFile,
    'COLUMN_PREFIX':InPrefix,
    'STATS':[0,1,2],
    }
    feedback = QgsProcessingFeedback()
    print("Starting zonalstats")
    processing.run("qgis:zonalstatistics", params)
    QgsApplication.exitQgis()
    app.exit()





    share|improve this answer




























      1














      Well, the issue turned out to be a minor one. I had failed to include "import processing". I post below the code that works. Also note that QGIS3 is rather quirky about the paths - the ones recommended in the documentation is not sufficient...hence my code goes overboard in including all - and hence it works. Also make sure you run the file with python3 (the default python is still python 2.7.5 in Qgis3). Hope this helps some who want to run standalone pyQGIS scripts in Qgis 3.



      import sys, os
      cwd = os.getcwd().replace("\","/")

      InVecFile = cwd+"/"+sys.argv[1] # Input vector/polygon file
      InRasFile = cwd+"/"+sys.argv[2] # Input raster file
      inx = sys.argv[2].split(".")
      InPrefix = inx[0]+"_"

      if len(sys.argv) < 2:
      print("USAGE: qgis3_ZonalStats.py <InVecFile> <InRasFile>")
      sys.exit()

      from qgis.core import (
      QgsApplication,
      QgsProcessingFeedback,
      QgsVectorLayer
      )

      from qgis.core import QgsApplication

      # See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
      QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
      qgs = QgsApplication([], False, None)
      qgs.initQgis()

      # Append the path where processing plugin can be found
      sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
      sys.path.append('e:\QGIS3\apps/Qt5\plugins')
      sys.path.append('e:\QGIS3\apps\qgis\python')
      sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
      sys.path.append('E:\Qgis3\apps\Python36\DLLs')
      sys.path.append('E:\Qgis3\apps\Python36\lib')
      sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32')
      sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32\lib')
      sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\Pythonwin')
      sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
      # Append location of DLLs to current system PATH envrionment variable
      # os.environ['PATH'] += r";C:Program FilesQGIS 2.14appsqgis-ltrbin;"

      import processing
      from processing.core.Processing import Processing
      Processing.initialize()
      print("Finished importing")

      # You can see what parameters are needed by the algorithm
      # using: processing.algorithmHelp("qgis:union")
      params = {
      'INPUT_RASTER':InRasFile,
      'RASTER_BAND':1,
      'INPUT_VECTOR':InVecFile,
      'COLUMN_PREFIX':InPrefix,
      'STATS':[0,1,2],
      }
      feedback = QgsProcessingFeedback()
      print("Starting zonalstats")
      processing.run("qgis:zonalstatistics", params)
      QgsApplication.exitQgis()
      app.exit()





      share|improve this answer


























        1












        1








        1







        Well, the issue turned out to be a minor one. I had failed to include "import processing". I post below the code that works. Also note that QGIS3 is rather quirky about the paths - the ones recommended in the documentation is not sufficient...hence my code goes overboard in including all - and hence it works. Also make sure you run the file with python3 (the default python is still python 2.7.5 in Qgis3). Hope this helps some who want to run standalone pyQGIS scripts in Qgis 3.



        import sys, os
        cwd = os.getcwd().replace("\","/")

        InVecFile = cwd+"/"+sys.argv[1] # Input vector/polygon file
        InRasFile = cwd+"/"+sys.argv[2] # Input raster file
        inx = sys.argv[2].split(".")
        InPrefix = inx[0]+"_"

        if len(sys.argv) < 2:
        print("USAGE: qgis3_ZonalStats.py <InVecFile> <InRasFile>")
        sys.exit()

        from qgis.core import (
        QgsApplication,
        QgsProcessingFeedback,
        QgsVectorLayer
        )

        from qgis.core import QgsApplication

        # See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
        QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
        qgs = QgsApplication([], False, None)
        qgs.initQgis()

        # Append the path where processing plugin can be found
        sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
        sys.path.append('e:\QGIS3\apps/Qt5\plugins')
        sys.path.append('e:\QGIS3\apps\qgis\python')
        sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
        sys.path.append('E:\Qgis3\apps\Python36\DLLs')
        sys.path.append('E:\Qgis3\apps\Python36\lib')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32\lib')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\Pythonwin')
        sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
        # Append location of DLLs to current system PATH envrionment variable
        # os.environ['PATH'] += r";C:Program FilesQGIS 2.14appsqgis-ltrbin;"

        import processing
        from processing.core.Processing import Processing
        Processing.initialize()
        print("Finished importing")

        # You can see what parameters are needed by the algorithm
        # using: processing.algorithmHelp("qgis:union")
        params = {
        'INPUT_RASTER':InRasFile,
        'RASTER_BAND':1,
        'INPUT_VECTOR':InVecFile,
        'COLUMN_PREFIX':InPrefix,
        'STATS':[0,1,2],
        }
        feedback = QgsProcessingFeedback()
        print("Starting zonalstats")
        processing.run("qgis:zonalstatistics", params)
        QgsApplication.exitQgis()
        app.exit()





        share|improve this answer













        Well, the issue turned out to be a minor one. I had failed to include "import processing". I post below the code that works. Also note that QGIS3 is rather quirky about the paths - the ones recommended in the documentation is not sufficient...hence my code goes overboard in including all - and hence it works. Also make sure you run the file with python3 (the default python is still python 2.7.5 in Qgis3). Hope this helps some who want to run standalone pyQGIS scripts in Qgis 3.



        import sys, os
        cwd = os.getcwd().replace("\","/")

        InVecFile = cwd+"/"+sys.argv[1] # Input vector/polygon file
        InRasFile = cwd+"/"+sys.argv[2] # Input raster file
        inx = sys.argv[2].split(".")
        InPrefix = inx[0]+"_"

        if len(sys.argv) < 2:
        print("USAGE: qgis3_ZonalStats.py <InVecFile> <InRasFile>")
        sys.exit()

        from qgis.core import (
        QgsApplication,
        QgsProcessingFeedback,
        QgsVectorLayer
        )

        from qgis.core import QgsApplication

        # See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
        QgsApplication.setPrefixPath('e:/Qgis3/apps/qgis', True)
        qgs = QgsApplication([], False, None)
        qgs.initQgis()

        # Append the path where processing plugin can be found
        sys.path.append('e:\QGIS3\apps\qgis\qtplugins')
        sys.path.append('e:\QGIS3\apps/Qt5\plugins')
        sys.path.append('e:\QGIS3\apps\qgis\python')
        sys.path.append('e:\QGIS3\apps\qgis\python\plugins')
        sys.path.append('E:\Qgis3\apps\Python36\DLLs')
        sys.path.append('E:\Qgis3\apps\Python36\lib')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\win32\lib')
        sys.path.append('E:\Qgis3\apps\Python36\lib\site-packages\Pythonwin')
        sys.path.append("e:\QGIS3\apps\Python36\Lib\site-packages")
        # Append location of DLLs to current system PATH envrionment variable
        # os.environ['PATH'] += r";C:Program FilesQGIS 2.14appsqgis-ltrbin;"

        import processing
        from processing.core.Processing import Processing
        Processing.initialize()
        print("Finished importing")

        # You can see what parameters are needed by the algorithm
        # using: processing.algorithmHelp("qgis:union")
        params = {
        'INPUT_RASTER':InRasFile,
        'RASTER_BAND':1,
        'INPUT_VECTOR':InVecFile,
        'COLUMN_PREFIX':InPrefix,
        'STATS':[0,1,2],
        }
        feedback = QgsProcessingFeedback()
        print("Starting zonalstats")
        processing.run("qgis:zonalstatistics", params)
        QgsApplication.exitQgis()
        app.exit()






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jun 8 '18 at 17:41









        ap_gisap_gis

        213




        213






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f285150%2fprocessing-step-is-ignored-in-qgis3-standalone-python-script%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Щит и меч (фильм) Содержание Названия серий | Сюжет |...

            Венесуэла на летних Олимпийских играх 2000 Содержание Состав...

            Meter-Bus Содержание Параметры шины | Стандартизация |...