Coloring points by raster values in QGIS?

You can use a data-defined override for the 'Fill color' property of the point layer to achieve this.

First you need to export your singleband raster as 3-band RGB image. Once you apply the colormap, right-click -> Export -> Save As.. In the export raster layer dialog, choose Output mode as 'Rendered Image'. Once exported and loaded, you can use the following expression

Assuming your RGB raster is called 'raster', use the expression as below:

concat(raster_value('raster', 1, $geometry), ',', raster_value('raster', 2, $geometry), ',', raster_value('raster', 3, $geometry))

This samples the value in the R, G and B bands of the raster and creates a string such as 119,20,89 which is used as r,g,b values for the fill color.

data defined override

marker color from raster

Tags:

Point

Raster

Qgis