I want to be able to specify two points and draw a line. If there is terrain loaded between these two points, I want to detect the terrain attributes and draw the line along the edges of the terrain. For example, if I cannot detect the terrain, the line I am drawing might sit under a mountain. Thanks.
Sounds like you are talking about "draping" geometry over the terrain. In osgEarth, there are several "feature" drivers that take geometry (points, lines, polys) and render them as part of the map. One of these is probably the most appropriate: