pyqgis: using gdalogr:rastercalculator not workingProgramatically use Openlayers plugin layer in Print...

How do I know my password or backup information is not being shared when creating a new wallet?

Why do we divide Permutations to get to Combinations?

How to achieve physical gender equality?

Does changing "sa" password require a SQL restart (in mixed mode)?

Why is Shelob considered evil?

Cryptic cross... with words

Reading source code and extracting json from a url

Why are `&array` and `array` pointing to the same address?

80-bit collision resistence because of 80-bit x87 registers?

Manager has noticed coworker's excessive breaks. Should I warn him?

Is corrosion inhibitor paste conductive?

Exploding Numbers

What if you do not believe in the project benefits?

Are all power cords made equal?

Do error bars on probabilities have any meaning?

Why is the meaning of kanji 閑 "leisure"?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Why don't reads from /dev/zero count as I/O?

Which part is the tail in 人参{にんじん}の尻尾{しっぽ}

Will linear voltage regulator step up current?

Why Third 'Reich'? Why is 'reich' not translated when 'third' is? What is the English synonym of reich?

Is Screenshot Time-tracking Common?

How does the income of your target audience matter for logo design?

Translation for threshold (figuratively)



pyqgis: using gdalogr:rastercalculator not working


Programatically use Openlayers plugin layer in Print ComposerQGIS from console: raster algebraLayer style is not rendered properly using PyQGIS“unexpected indent” in the scriptPyQGIS: gdalogr:cliprasterbymasklayer new options?ring buffer code not working with pyqgisHow to get all attributes from overlapping polygons with identical geometry into one single polygon in QGISPyQGIS function not working“measureLine” not working in pyqgis 3.0PyQGIS save as .TAB not working?













1















I have an Int16 - 16 bit GeoTiff and would like to do a simple calculation.
Using the GUI in QGIS (raster calculator) it works without problems. The expression in the raster calculator is: Raster_Image * 0.04 - 273.15



I want to do the calculation via pyqgis. For this I would like to use the process gdalogr: rastercalculator.



I tried the following:



import processing
# Get actual raster layer (GeoTiff)
layer = iface.activeLayer();
output = processing.runalg('gdalogr:rastercalculator',
layer, #INPUT_A <ParameterRaster>
'1', #BAND_A <ParameterString>
None, #INPUT_B <ParameterRaster>
'', #BAND_B <ParameterString>
None, #INPUT_C <ParameterRaster>
'', #BAND_C <ParameterString>
None, #INPUT_D <ParameterRaster>
'', #BAND_D <ParameterString>
None, #INPUT_E <ParameterRaster>
'', #BAND_E <ParameterString>
None, #INPUT_F <ParameterRaster>
'', #BAND_F <ParameterString>
'A*0.04-273.15', #FORMULA <ParameterString>
'', #NO_DATA <ParameterString>
'1', #RTYPE <ParameterSelection>
'', #EXTRA <ParameterString>
None) #OUTPUT <OutputRaster>
rLayer= QgsRasterLayer(output['OUTPUT'],'result')
print rLayer.isValid()


The calculated raster is not valid. I just do not understand what I'm doing wrong.










share|improve this question



























    1















    I have an Int16 - 16 bit GeoTiff and would like to do a simple calculation.
    Using the GUI in QGIS (raster calculator) it works without problems. The expression in the raster calculator is: Raster_Image * 0.04 - 273.15



    I want to do the calculation via pyqgis. For this I would like to use the process gdalogr: rastercalculator.



    I tried the following:



    import processing
    # Get actual raster layer (GeoTiff)
    layer = iface.activeLayer();
    output = processing.runalg('gdalogr:rastercalculator',
    layer, #INPUT_A <ParameterRaster>
    '1', #BAND_A <ParameterString>
    None, #INPUT_B <ParameterRaster>
    '', #BAND_B <ParameterString>
    None, #INPUT_C <ParameterRaster>
    '', #BAND_C <ParameterString>
    None, #INPUT_D <ParameterRaster>
    '', #BAND_D <ParameterString>
    None, #INPUT_E <ParameterRaster>
    '', #BAND_E <ParameterString>
    None, #INPUT_F <ParameterRaster>
    '', #BAND_F <ParameterString>
    'A*0.04-273.15', #FORMULA <ParameterString>
    '', #NO_DATA <ParameterString>
    '1', #RTYPE <ParameterSelection>
    '', #EXTRA <ParameterString>
    None) #OUTPUT <OutputRaster>
    rLayer= QgsRasterLayer(output['OUTPUT'],'result')
    print rLayer.isValid()


    The calculated raster is not valid. I just do not understand what I'm doing wrong.










    share|improve this question

























      1












      1








      1








      I have an Int16 - 16 bit GeoTiff and would like to do a simple calculation.
      Using the GUI in QGIS (raster calculator) it works without problems. The expression in the raster calculator is: Raster_Image * 0.04 - 273.15



      I want to do the calculation via pyqgis. For this I would like to use the process gdalogr: rastercalculator.



      I tried the following:



      import processing
      # Get actual raster layer (GeoTiff)
      layer = iface.activeLayer();
      output = processing.runalg('gdalogr:rastercalculator',
      layer, #INPUT_A <ParameterRaster>
      '1', #BAND_A <ParameterString>
      None, #INPUT_B <ParameterRaster>
      '', #BAND_B <ParameterString>
      None, #INPUT_C <ParameterRaster>
      '', #BAND_C <ParameterString>
      None, #INPUT_D <ParameterRaster>
      '', #BAND_D <ParameterString>
      None, #INPUT_E <ParameterRaster>
      '', #BAND_E <ParameterString>
      None, #INPUT_F <ParameterRaster>
      '', #BAND_F <ParameterString>
      'A*0.04-273.15', #FORMULA <ParameterString>
      '', #NO_DATA <ParameterString>
      '1', #RTYPE <ParameterSelection>
      '', #EXTRA <ParameterString>
      None) #OUTPUT <OutputRaster>
      rLayer= QgsRasterLayer(output['OUTPUT'],'result')
      print rLayer.isValid()


      The calculated raster is not valid. I just do not understand what I'm doing wrong.










      share|improve this question














      I have an Int16 - 16 bit GeoTiff and would like to do a simple calculation.
      Using the GUI in QGIS (raster calculator) it works without problems. The expression in the raster calculator is: Raster_Image * 0.04 - 273.15



      I want to do the calculation via pyqgis. For this I would like to use the process gdalogr: rastercalculator.



      I tried the following:



      import processing
      # Get actual raster layer (GeoTiff)
      layer = iface.activeLayer();
      output = processing.runalg('gdalogr:rastercalculator',
      layer, #INPUT_A <ParameterRaster>
      '1', #BAND_A <ParameterString>
      None, #INPUT_B <ParameterRaster>
      '', #BAND_B <ParameterString>
      None, #INPUT_C <ParameterRaster>
      '', #BAND_C <ParameterString>
      None, #INPUT_D <ParameterRaster>
      '', #BAND_D <ParameterString>
      None, #INPUT_E <ParameterRaster>
      '', #BAND_E <ParameterString>
      None, #INPUT_F <ParameterRaster>
      '', #BAND_F <ParameterString>
      'A*0.04-273.15', #FORMULA <ParameterString>
      '', #NO_DATA <ParameterString>
      '1', #RTYPE <ParameterSelection>
      '', #EXTRA <ParameterString>
      None) #OUTPUT <OutputRaster>
      rLayer= QgsRasterLayer(output['OUTPUT'],'result')
      print rLayer.isValid()


      The calculated raster is not valid. I just do not understand what I'm doing wrong.







      pyqgis qgis-2 gdalogr






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      eftaseftas

      347113




      347113






















          0






          active

          oldest

          votes











          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%2f313072%2fpyqgis-using-gdalogrrastercalculator-not-working%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f313072%2fpyqgis-using-gdalogrrastercalculator-not-working%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

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

          is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

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