# Calculate slope of line based off of point layer

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? Commented Jul 20, 2015 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. Commented Jul 21, 2015 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 Commented Jul 21, 2015 at 23:43

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)
``````
• 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