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.
Asked
Active
Viewed 1,026 times
2
-
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
1 Answers
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).

This allows you to use SOHCAHTOA to calculate the slope angle.
tan(slope) = (opposite / adjacent)
slope = atan(opposite / adjacent)
Stephen Lead
- 21,119
- 17
- 113
- 240
-
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 02:00
-
3Yep, 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 02: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 03:24
-
-
Specify the Join Type as
JOIN_ONE_TO_MANYin the Join or Spatial Join dialog. Or use a Relate if that doesn't work. – John Jul 21 '15 at 20:34 -
1The 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
-
-
Sounds like I will need to ask a follow up question. The issue I see coming up is that most of the points are both a start point for one line and an end point for another at the same time. I have an advanced ArcMap license but no spatial or 3D analyst extensions. – cbunn Jul 22 '15 at 14:22
-
Posted a follow up question here: http://gis.stackexchange.com/questions/155421/determine-start-end-points-for-line-slope-calculation – cbunn Jul 22 '15 at 14:39
-
@John the one_to_many option would duplicate the lines once for each point, and even if you did that and merged the two records you're still left figuring out which is the start value and which is the end. And I'm not aware of any way to access a related field via a field calculation. – Chris W Jul 22 '15 at 20:01