I have two raster datasets (maps of forest cover) and I would like to compare whether the data in these two rasters match.

Can someone please help me understand how to create random points and then extract the data (from both rasters) for these points, and later plot on a scatter plot in excel?

I use QGIS.

  • What does the pixel values represent? Forest height?
    – Bera
    Commented Jun 23, 2021 at 16:56

1 Answer 1


Option 1

Use raster calculator to compare each pixel with this expression "raster1@1"="raster2@1". It creates a binary raster (0/1) showing in black and white if pixels are identical or not.

Option 2

  1. Create random points: Menu Vector / Research Tools / Random points in extent

  2. Create new attributes for each raster using this expression: raster_value( 'raster',1,$geometry), replacing raster with the name of your raster layers and 1 with the number of the raster-band you want to get the value from. Repeat this/create a separate field for all raster-layers to be able to compare the values.

Then export the layer as CSV and open it in Excel for scatter plots. Or create scatter plots in QGIS with Data Plotly plugin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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