2

I have a DEM raster and some points (one .shp for all points) plotted on it.

I would like to know if there is a way to add the slope value of the pixel that each point is located in the attribute table of the point's shp.

Solutions using Python are also welcome.

2

You can use the Plugin "Point Sampling Tool".

Simlply choose your points layer and your DEM raster and an output:

enter image description here

Done.

3

Under the Raster Analysis toolbox, you can find the tool Sample Raster Values. This tool does precisely what you're asking for. According to the help:

This algorithm creates a new vector layer with the same attributes of the input layer and the raster values corresponding to the point location. If the raster layer has more than one band, all the band values are sampled.

raster sampling

EDIT: Note that this algorithm can also be used in Python with the processing.run command.

  • actually even more convenient since no plugin is needed – MrXsquared May 10 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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