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.

1

2 Answers 2

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.

1
  • actually even more convenient since no plugin is needed
    – MrXsquared
    May 10, 2019 at 19:36
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.

Your Answer

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

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