I would like to compare satellite pictures (raster) infra - red.

I have 2 rasters from the same area. I would like the compare pixels with the same xy coordinate using PyQGIS.

10 different values between the same= O and totaly different = 10. 10 different red colors.

So I can compare leaf green the state of the vegetation.

How do I start and which why to go?

closed as off-topic by Mark Ireland, PolyGeo Nov 9 '18 at 23:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Mark Ireland, PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.


If you want compare values in 2 raster files, I recommend to use raster calculator in QGIS.

  1. Load 2 rasters to QGIS
  2. Raster -> Raster calculator
  3. write "B4@1" - "B5@1" in Raster calculator expression area.
  4. give any name for output layer
  5. pressOK

raster calculator The above steps gives you a raster that values are differences of 2 rasters. To obtain values of that raster at coordinates of points layer,

  1. Open attribute table of points layer
  2. Toggle to editing mode (Ctrl + E)
  3. Open field calculator (Ctrl + I)
  4. Write expression raster_value('out',1,make_point($x, $y)). out should be replace your created raster name.
  5. pressOK field calculator

You will get new laster layers values at each point in attribute table.

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