2

I have a line feature class that needs to have its slope included as a field. I have a point layer that contains points and their elevations for the start and end of the line segments. How can I calculate the slope of the line feature class using my point layer? I am open to Python, QGIS, & ArcMap solutions.

  • You could create a surface and get the elevation onto the lines that way, how close are your elevation points to the ends of the line? Are they close enough for a spatial join? Are your start and end points separate or in the same feature class? Are they only 2 point lines (start->end only) or do you need to calculate an average slope? – Michael Stimson Jul 20 '15 at 23:53
  • My start/end points are directly on top of my lines. My start/end points are in the same feature class. Only 2 points per line segment, with line segments sharing points as they are continuous. – cbunn Jul 21 '15 at 13:30
  • @cbunn I'd suggest posting a separate question around how to join the start/end points to the lines (Stack Exchange works best when there's a single question to answer). Be sure to include all the details about the points being coincident, lines being continuous, etc. Ideally include some screenshots too – Stephen Lead Jul 21 '15 at 23:43
6

Join the points to the lines, using a spatial or table join, to give the elevation (Z) at each end of the line. This allows you to calculate the elevation change (Z1 - Z2). Use your GIS to calculate the 2D length of the line (Shape.length).

enter image description here

This allows you to use SOHCAHTOA to calculate the slope angle.

tan(slope)  = (opposite / adjacent)
slope = atan(opposite / adjacent)
  • This will only work if the points are coincident with the ends of the lines, or if the points and lines share some attribute to enable joining – Adam Jul 21 '15 at 2:00
  • 3
    Yep, I glossed over that in "join the points to the lines" since that's really a separate question which has been answered many times – Stephen Lead Jul 21 '15 at 2:36
  • 1
    @Adam, it's valid as the OP indicates that the "point layer that contains points and their elevations for the start and end of the line segments" – Fezter Jul 21 '15 at 3:24
  • @StephenLead how do I join 2 points to 1 line? – cbunn Jul 21 '15 at 17:59
  • 1
    The trick is working out which one is which, that would take a little bit of maths and is totally worthy of a new question in itself. I wouldn't join straight to the lines, I would use feature vertices to points (start then end) join the end points to the Z points then join that to the lines. I have an advanced license so I can do that... instructions for basic and standard are substantially longer and would be better scripted. As Stephen said, that's been covered a few times so to tackle that aspect would be to risk duplication of effort. – Michael Stimson Jul 21 '15 at 21:33

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.