1

I have a DEM/grid with elevation values that's patchy and I have linear features crossing these areas. What I wanted to do is to measure the min and max elevation points falling along the line.

My approach was to sample the line at a given sample rate and create point features, then get the elevation of this line of points from the DEM/grid, but how can I know look to those points to get min and max points only?

Then how I want to proceed is to copy min and max values as an attribute to the line I have, I think this can be done using ID's?

1
  • 1
    Are you asking how the min() and max() expression work, or how to use the statistics tool?
    – Erik
    Jan 24 at 8:27

1 Answer 1

2

you can use the field-calculator to extract min and max value into a new field of your line layer with the following type of expression - example for max value, same for min value with array_min:

array_max(with_variable('my_series', 
      generate_series(0,$length,10),
      array_foreach(@my_series,  
      raster_value('dem',1, 
      line_interpolate_point($geometry,@element)))))

this makes a series of points anlong the line - every 10 meters in the example above - and then gets the rastervalues from the layer "dem" and put them into an array...

1
  • I'll have a try with your suggestion, still a rookie with writing expression. However, after several attempts I managed to get the following solution: 1) get a unique ID on each line
    – Oli88
    Jan 25 at 10:15

Your Answer

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

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