I am writing a QGis plugin, for QGis 2.10, which imports processing 2.10.3, that needs:

testproc = processing.runalg('gdalogr:warpreproject',
                          thisName, # input
                          thisCRS, # source crs
                          thisNewCRS, # dest srs
                          '0', # no data, <parameterString>
                          0, # target resolution: 0=unchanged
                          0, # method: 0, as we are only clipping
                          0, # output raster type
                          2, # compression
                          None, # jpeg compression
                          None, # zlevel
                          None, # predictor
                          None, # tiled
                          None, # bigtiff
                          None, # TFW
                          extraParam, # extra 

extraParam is a string I used to clip my raster with a shapefile, using -clip option. It works for me with processing 2.10.3. I need to give this plugin to someone using processing 2.12.2. with QGis 2.12.0 (since this version of QGis requires a more recent version of the plugin). It fails: I think that the input for this command changed.

  1. how I can detect the version of processing (after doing import processing). I would like to adapt the behaviour to the version, as the long term release uses 2.10.3
  2. what changed in the new version, in term of inputs?
  • 1
    How does it fail? The error produced may answer parts of your questions. It doesn't look as if processing exports any useful version information, but you could possibly trap the exception produced and retry with different parameters.
    – larsks
    Nov 25 '15 at 14:37

I think the reason it fails is because processing version 2.12.2 requires QGIS 2.12.0 atleast (and you mentioned you use QGIS 2.10 which works fine with processing 2.10.3. See the plugin repository for more details but the following is a screenshot of the repository):

Screenshot of repository

Not sure about detecting the processing version after using import processing but you can obtain its version and other pieces of information which are shown from the Plugins Manager by using the following code (slightly modified from this post, thanks to @StevenKay):

for x in qgis.utils.findPlugins("/home/you/.qgis2/python/plugins"): 
    if x[0] == 'processing':
            for key in x[1].options('general'):
                print "%s = %s" % (key, x[1].get('general',key))

In terms of inputs, there are no differences. Running processing.alghelp('gdalogr:warpreproject') and using a comparison tool had shown that both versions use the exact same parameters (red lines show differences which only occurs at the top which I inserted to differentiate between the two versions):

Diffuse tool to compare

  • Thank you for your research. Actually my colleague use QGis 12 and processing 12 (I've edited my question), that's why I though the list of input parameter changed, but you show it is not the case. Can you tell me where to find the text describing the command? Nov 27 '15 at 6:51
  • @BrunovonParis - Most welcome buddy! You can find text from the QGIS 2.8 documentation (which should still be similar) or extract the parameter info from the Processing plugin itself using processing.alghelp('gdalogr:warpreproject') in the Python Console (you may need to import processing first).
    – Joseph
    Nov 30 '15 at 10:32
  • 1
    Hello, I have found this post and I would like to ask that, I am using QGIS 2.14, and when I type in processing.alghelp(gdalogr:warpreproject) in the console (after import processing), it returns : Algorithm not found. Has this changed in the new version of QGIS? I can't find anything about this.
    – user64823
    Apr 18 '16 at 13:34
  • 1
    @user64823 You need quotes around the algorithm name in alghelp(), I think. Jun 27 '16 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.