4

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

  • 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? – ycartwhelen Jun 14 '18 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. – glacierguru Jun 14 '18 at 19:55
2

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.

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.