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.

Kajo
  • 691
  • 1
  • 6
  • 11
  • 1
    Possible duplicated https://gis.stackexchange.com/questions/3538/extracting-raster-values-at-points-using-open-source-gis – Fran Raga May 10 '19 at 19:27

2 Answers2

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.

jcarlson
  • 3,880
  • 1
  • 13
  • 34
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.

MrXsquared
  • 34,292
  • 21
  • 67
  • 117