# Tag Info

0

Thanks for the answers! However, I somehow still don't get it running. I also made sure to clip the rasters to the same extent. If I am only doing calculations with one layer, the script works, but if I want to calculate with two layers, I don't receive any output (but also no error messages). Any ideas? Thanks!

0

It seems that "Lookup" tool in Spatial Analyst would do what I am after. Lookup tool

2

The easiest way to turn negative to corresponding positive values in raster calculator without even using a conditional statement is simply the function abs(): ABS ( "DEM@1" ) See result for the area of the Jordan valley and the Dead Sea (red ouline) that is changed to positive values, whereas the rest remains: left - original DEM, right - output ...

1

Here's a stab at solving this. For the east-west case (north-south is essentially the same): An image where each pixel represent the distance to the point is combined with the LST band, pixels not on the east-west line are masked out, and features with distance and LST are created for every non-masked out pixel. var image = lstAdded_2019.first().select('LST')...

5

For QGIS versions older than 3.22, you can create a conditional statement for what you want to do with this expression: ("DEM@1" < 0) * (-1) * "DEM@1" + ABS ( ("DEM@1" < 0) - 1) * "DEM@1" Output: 100 -> 100 2 -> 2 -5 -> 5 -150 -> 150 etc.

2

In previous versions it simply performs an assignment, a conditional within a parenthesis followed by a *, performs an assignment to all pixels that meet that condition. Try this: ("DEM" < 0 ) *0 + ("DEM" >= 0 ) *"DEM" It will convert all values less than 0 to 0, and leave all other pixels the same. On the other hand, if ...

3

If you use the newest QGIS version 3.22, the raster calculator has a new if-condition. Use this expression: if ( "DEM@1" <0, "DEM@1" * -1, "DEM@1")

1

Your Acreage field is simply an attribute you created and tagged onto the end of the raster attribute table. It is Value field in the raster dataset that holds the value of the pixel. To replace the pixel value to the value held in the Acreage field you need to do the following: Export the attribute table of your Raster1 dataset to a stand alone table, e.g. ...

1

gdal_calc uses python syntax. In python = is used for variable assignment and == is for equality checking. E.g. >>> a = 123 >>> print(a) 123 >>> a == 123 True >>> a == 1234 False So the following should work: gdal_calc --calc "(A == 0) * B + (A != 0) * A" --format GTiff --type Float32 -A C:\Users\Public\try\...

2

Use the Raster Calculator tool with the Con and IsNull functions to set the output raster to the existing landuse value where proposed landuse is null, otherwise set to 9. Note: make sure you set the tool environment processing extent and snap raster if the rasters have different dimensions. Con(IsNull("PROPOSED"), "LANDUSE", 9)

0

Thanks for all the inputs from your side. I finally solved the problem by changing the variable to 'OPTIONS': 'COMPRESS=LZW'.

Top 50 recent answers are included