Calculate grade from lat/lon and elevation?

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
How would I calculate grade when I have lat, lon and elevation? I guess I would first need to calculate the distance between twp coordinates would be my first step. Then some geometry to get the grade.

So how do I calculate the distance? I have probably done it a million years ago but it is slipping my mind now,

Code:
lat lon ele
45.7079499587 -121.5234399587 94.3
45.7079499587 -121.5231900103 94
45.7079399843 -121.5225099865 93.5
45.7079399843 -121.5223000199 93.4
45.7079399843 -121.5220599622 93.4
45.7079699915 -121.5214200038 92.3
45.7079900242 -121.5201199707 89.1
45.7080300059 -121.519029988 83.8
45.7080500387 -121.5184600186 82.6
45.7080699876 -121.5180099942 81.1
45.7080999948 -121.5173199959 78.7
45.7080999948 -121.5172700398 78.6
45.7080999948 -121.5171699598 78.4
45.708130002 -121.516369991 75.6
45.7081399765 -121.5161399916 73.2
45.7081500348 -121.5158700105 69.7
45.7081500348 -121.5156899672 67.8
 

WBahn

Joined Mar 31, 2012
29,976
There's going to be some assumptions that go into it, namely the shape of the Earth.

As a start, you could assume that the Earth is a perfect sphere and calculate the great circle distance between the points. That's extremely easy. But given the small differences in elevation you are dealing with, it might not be good enough. You can probably get a good feel for that by seeing how much of a difference it makes if you use the Earth's major and minor diameters. If it's tolerable, then you are done. If not, then it would probably be good enough to find the correct radius to use in that area, which can probably be backed out from local measurement data if nothing else.

Where are those lat/lon numbers coming from? Are they really as accurate/precise as implied by values you give? More to the point, are they actually as accurate/precise as you need for what you are doing?
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Well it is only a distance of 43 miles (for the whole track) so I doubt rath curvature is going to make much of a difference.

The data comes from ridewithgps which is Google Earth data. RidewithGPS provides a ride profile of the grades along the way, a max grade amf min grade but they don't provide an average. I would like to calculate the average.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
This is what the data looks like when I load it into BaseCamp. All they have is the position and elevation so they must be calculating that data somehow. They have a grade which I assume is average grade.



upload_2018-12-10_8-30-51.png
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Just as am FYI, I need to ride from Hood River, OR to Government Camp, OR this summer. It has been a while since I have made one of those long climbs by bicycle. It is pretty much uphill for 43 miles. Just trying to figure out what I am getting myself into. ;)


upload_2018-12-10_9-18-12.png
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
What is wrong with simply taking difference in Elevation divided by Leg Distance?

If I had the leg distance. I only have position and elevation. The graphic table I posted was calculated in software. Would be nice to know how they did it.
 

MrChips

Joined Oct 2, 2009
30,707
Simple geometry.

Find the distance between two points.



At the current geo-location, find the conversion factors from latitude and longitude angles to distances.
These will not change over the relatively short distances.
Find the delta latitude angle and delta longitude angle. Convert to delta distances.
Find the square root of the sum of the squares.
That is your Leg Distance.
 

wayneh

Joined Sep 9, 2010
17,496
If I had the leg distance. I only have position and elevation. The graphic table I posted was calculated in software. Would be nice to know how they did it.
If I was doing it, I’d divide the trip into intervals, say 200-1000. You can’t see much more resolution than that in a chart. I might make some effort to choose points at the mins and maxes. Plot elevation against distance for all those points.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
I would go the other way.:)
:):)

Well once I get to the top I get this.

upload_2018-12-10_9-31-29.png

Going the other way would mean climbing that. There ain't no such thing as a free lunch. Going the other way would also mean heading west down the Columbia River Gorge which could be far worse than climbing the mountain.


This wind is not confined to just the water. ;)
upload_2018-12-10_9-38-35.png
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
If I was doing it, I’d divide the trip into intervals, say 200-1000. You can’t see much more resolution than that in a chart. I might make some effort to choose points at the mins and maxes. Plot elevation against distance for all those points.

I did just that. A couple of bumps here and there but does mot look too bad. Left column is miles. 3% is railroad grade btw and the max grade on most rails to trails bike paths.


upload_2018-12-10_10-12-8.png
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Looks like a nice shoulder much of the way? What time of year was that? Not too much traffic from the looks of it.
 

Thread Starter

spinnaker

Joined Oct 29, 2009
7,830
Simple geometry.

Find the distance between two points.



At the current geo-location, find the conversion factors from latitude and longitude angles to distances.
These will not change over the relatively short distances.
Find the delta latitude angle and delta longitude angle. Convert to delta distances.
Find the square root of the sum of the squares.
That is your Leg Distance.

So I can just use my degrees for X1,2,Y1,Y2?
I might try sticking this in a spreadsheet a bit later and see if the numbers match up. Thanks
 

MrChips

Joined Oct 2, 2009
30,707
No. You have to convert degrees into distances.
As you are a sailor this should be familiar to you.
You can look this up or do you wish me to do that for you?
 

nsaspook

Joined Aug 27, 2009
13,079
Looks like a nice shoulder much of the way? What time of year was that? Not too much traffic from the looks of it.
Looking at how dry the grass is on that video I would guess mid to late summer.

Another with a strange view:

Hope you plan on spending the night at Gov camp or at Timberline.
 
Last edited:

wayneh

Joined Sep 9, 2010
17,496
I did just that. A couple of bumps here and there but does mot look too bad. Left column is miles. 3% is railroad grade btw and the max grade on most rails to trails bike paths.


View attachment 165495
I ride some rails-to-trails and most have grades of 1% or less. I've learned over many rides that it's hard to detect a grade below ~0.5% without instruments. For instance my favorite out-and-back ride gains just 100' in 10 miles. My outbound (uphill) speed will be about 2mph less than the return. Since my pulse is the same both ways, they "feel" about the same, I'm just going a bit faster coming back. Conversely a grade of 5-10% feels like climbing a wall!
 
Top