1

There is plenty unknown about how to use raster calculator, for example:

  1. how to write NODATA (Null) value in expression
  2. is it possible to use within (polygonLayerName) to clip result
  3. between shown operators there is even "not equal" symbol, you need to find yourself it is "!=" etc.

Generally is there any manual/help/tutorial to QGIS raster calculator describing what is and is not possible to do with it?

Miro
  • 9,744
  • 8
  • 49
  • 87
  • 1
    "...is and is not posssible" is a pretty broad question. Are you looking for something beyond the Documentation or this high-ranked search result? Some of your questions, such as the nodata / null issue are addressed at other questions here on GIS.SE. There is also the Raster Calc Plugin, which is different from the Raster Calculator in QGIS and has some documentation at the link. – Chris W May 30 '14 at 20:49
  • The "is not" is meant in the way of only important basics like for example you can't calculate grids in different projections, can you? The documentation site is brand new to me so thank you for that. If that site would add info about projection, null value, not equal, (possible clipping to polygon layer?) and few more advanced examples than it is all I am after. Thank you. Also info about Raster Calc Plugin is great, I didn't know about that either. – Miro Jun 02 '14 at 00:28

1 Answers1

3

There is the Raster Calculator Documentation file and this Tutorial which give some information and examples. I am not positive, but I believe the Raster Calculator is 'what you see is what you get' in terms of functionality. There is a plugin available called RasterCalc that provides more functions (compared to the default Raster Calculator - not equal, for example) using both buttons and functions only available by typing them in, as noted at the link.

Some of your other questions may be more general in nature as to how raster calculation works and not the specific tool (ie projections, differing cell sizes and extents, etc.). Null values may also fall in that category - there is another question here on SE related to that: How to change null values raster values to 0 in QGIS? Clipping to a polygon layer could be something also known as a mask but it looks like the two options above only mask by values. There is a tool for it though.

Chris W
  • 15,720
  • 2
  • 29
  • 47
  • Thank you, I am hesitating to accept this answer because though it is very helpful it doesn't answer how to work with no data (Null) value which is first and one of the most important parts of my question. Unless there is no way to specify NULL value in raster calculator so I can't do expression "IF A!=Null keep A, IF A=Null take B" – Miro Jun 02 '14 at 05:34
  • And my NULL value in TIF files is (probably because of conversion from other format - ERS/Surfer GRD) something like 1.70141e+38. – Miro Jun 02 '14 at 05:42
  • 1
    @miro I believe null values is a general issue to QGIS and not the raster calculator specifically. Per a comment on one of the answers in that question I linked to, you can set in the QGIS preferences how null values are represented in a raster. It appears that neither raster calculator can address null directly. – Chris W Jun 02 '14 at 20:50
  • 1
    Fair enough, I am taking it as not possible, thank you. – Miro Jun 02 '14 at 23:54
  • @Miro 'Not possible' is too definitive for me. The solution as I understand it would be to set your preferences to treat null as a specific (non-occuring) value, such as -9999. Then your forumula would address the nulls by that value. In your case you could set null to 0, use a mask that filters out everything that isn't 0, then add B to A, which would give you the values of B everywhere A has a null. At least I think I have that right - sorry I can't give you the exact input to type in. You might ask that specific case/problem as another question. – Chris W Jun 03 '14 at 00:05
  • 1
    Oh sure it is possible. I can use gdal_translate (Raster/Conversion/Translate), set the Nodata end edit expression to -a_nodata None. Then the Null value becomes something like 1.70141e+38 which I can mask in raster calculator by something like A<10000 because all other values are way below that. I meant it is not possible with raster calculator itself. – Miro Jun 03 '14 at 00:46