1

I'm running Qgis 3 processing modeler and I am trying to invert the values of a raster file.

I had previously asked this question and the answer I came up with works with the raster calculator when processing the layer. However when I try the same thing within a processing modeler I get a blank raster file. enter image description here

This is the raster info from the proximity output.

Driver: GTiff/GeoTIFF
Files: C:/Users/Timothy/AppData/Local/Temp/processing_54c8e3d84eb144a88f3f486c6ae75076/c5fc54eb536f4b1cbe57b7ef55506bb2/gdal_proximity_1_proximity.tif
Size is 1000, 1000
Coordinate System is:
PROJCS["USA_Contiguous_Albers_Equal_Area_Conic",
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS 1980",6378137,298.2572221010042,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6269"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4269"]],
    PROJECTION["Albers_Conic_Equal_Area"],
    PARAMETER["standard_parallel_1",29.5],
    PARAMETER["standard_parallel_2",45.5],
    PARAMETER["latitude_of_center",37.5],
    PARAMETER["longitude_of_center",-96],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-2249531.050643497612327,289551.660125185269862)
Pixel Size = (0.577937172434758,-0.330446977802843)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-2249531.051,  289551.660) (121d56'57.53"W, 37d19'33.78"N)
Lower Left  (-2249531.051,  289221.213) (121d56'53.88"W, 37d19'23.56"N)
Upper Right (-2248953.113,  289551.660) (121d56'34.71"W, 37d19'38.79"N)
Lower Right (-2248953.113,  289221.213) (121d56'31.06"W, 37d19'28.56"N)
Center      (-2249242.082,  289386.437) (121d56'44.30"W, 37d19'31.17"N)
Band 1 Block=1000x2 Type=Float32, ColorInterp=Gray

raster calculator setting within processing modeler

  • There are a problem in that expression, must be 1000 - "'Proximity map' from algorithm 'Proximity (raster distance)'@1". Create named outputs for Rasterize and Proximity to check their results. If the intermediate results looks fine, add a Raster information process for the Proximity output, create an .html output file and add its content to the question. Besides that, if you select a Reference layer (for automated extent, cellsize, and CRS) at the Raster calculator, don't fill that values manually, or vice versa. A contradiction between them will produce an error. – Gabriel De Luca Jan 18 at 2:42
  • Changing the expression didn't make a difference I still got the same blank output. The Rasterize and Proximity outputs are fine I can process proximity with the stand alone raster calculator. It just doesn't seem to be working within the modeler. I added the r.info data to the question. Interesting note, you can not use an algorithm as a reference for raster calculator if that algorithm has an output. – brink Jan 18 at 19:07
  • I was referring to the information provided by the Raster information tool. – Gabriel De Luca Jan 18 at 19:15
  • It is probably part of the same problem, but yes, you can use the output of an algorithm as an input to the Raster Calculator, although that algorithm also has a named output. As long as the output is a raster layer. I guess that's what you meant. A mention about which version of QGIS 3 you are using, would not hurt either. – Gabriel De Luca Jan 18 at 20:00
  • @GabrielDeLuca, ok I just updated the question with the data from the Raster Information tool. Qgis 3.2.3.is the version. – brink Jan 18 at 20:42
1

It's all right with the raster layer created by the Proximity tool.

But unfortunately there was a problem with the Raster Calculator tool when it worked behind the modeler, in versions 3.2 of QGIS.

You will definitely not be able to have your model working as it is in that version.

Chances are you can try to use the Raster Calculator provided by GDAL (GDAL > Raster miscellaneous > Raster Calculator), it worked well when the QGIS calculator failed.

Also, my recommendation is that you update your version of QGIS (if you are a Windows user, and you installed through the stand-alone build installer, my recommendation changes, but if you installed from the OSGeo4W Network Installer, you can update from there and it works very well). Many bugs are already fixed.

  • Disregard last comment. I used OSGeo4W, I'll have to look around on how to update it. Thanks for the help. – brink Jan 18 at 22:10
  • You are welcome. – Gabriel De Luca Jan 18 at 22:49

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.