5

I'm trying to extract raster values along multiple shapefiles in QGIS for further analysis. I've successfully extracted values for points, so I either need to convert my vector shapefile to points (with the same spacing as my raster pixel resolution), or I need a tool to extract values along the vector line. I've tried Zonal Statistics, but I need to extract each pixel value, not the sum/count/mean etc.enter image description here

2
  • Could you clarify how you want the pixel values to be attached to the line? It's not clear what kind of output you want. Are pixel values going to become multiple attributes of the polyline shapefile? Are you trying to trying to make some kind of plot like the change in elevation over a DEM transect? Jun 14, 2018 at 19:47
  • I am hoping to make a histogram of pixel values. It'd be ideal if I could extract them in csv format with X and Y locations, but that's not necessary. Jun 14, 2018 at 19:55

1 Answer 1

6

Try SAGA Tool Profiles from lines (in QGIS Processng Toolbox | SAGA | Terrain Analysis - Profiles), which extracts all cell values underlie the line you have given.

Activate the tool, then:

  • DEM: Select your raster as input.

  • Line: Select your line layer.

  • Name: If you have multiple lines, then specify an (unique) ID field. It will help you to identify which line (aka "profile") the data belongs to.

  • [x] Each line as new profile: You can leave it on.

    I think you would need Nearest neighbour as resampling method, to extract the cell values without any modification.

5
  • Does this still work now? I do not have the option Each line as a new profil. I am using qgis 3.24 and saga 7.3
    – Lenn
    Apr 8, 2022 at 16:35
  • @Lenn I have just newly installed QGIS 3.24.1 and I do see that option.
    – Kazuhito
    Apr 8, 2022 at 17:45
  • oh cool! That is kind of strange though:/ Is it named the "Profiles from Lines" algorithm?
    – Lenn
    Apr 8, 2022 at 17:54
  • @Lenn Yes, yes it is.
    – Kazuhito
    Apr 8, 2022 at 17:56
  • Thanks a lot!:) For some reason I do not see it:/
    – Lenn
    Apr 8, 2022 at 19:37

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.