The GPX file drawn below was generated by MapMyRide, then resaved into a format this script would understand with GPSBabel. Finally, the GPX file was edited with a text editor to delete the <trkseg> - </trkseg> pair, and replace all occurrences of "trk" with "rte".
This is is the 3rd in a series of attempts to get good looking routes on a Google Map plus get good elevation data. The ultimate goal is to also get a reasonable % grade from the elevation data. For previous efforts, see here and here.
Unlike the previous 2 efforts (using Garmin 205 output), this map was produced by MapMyRide. So it isn't the victim of bad hair days for the GPS system. You'd expect perfect latitude and longitude values, and... that's what you get. If you didn't, then either MapMyRide can't really "Follow roads" or Google Maps is wrong. Fortunately neither of those conditions exist here - you'll notice that the route follows the roads through the Park very closely (although I did have to manually enter several points south of the Illinois monument where Google Maps inexplicably lops off Union Avenue).
So... how to get elevation? MapMyRide will produce an elevation vs. distance CSV file (click the "SHOW ELEVATION" widget at the bottom of a map, then click "raw data (csv)"). That elevation vs. distance data is plotted below (the green curve, labelled "MapMyRide"). One weakness I saw in MapMyRide's output is that the CSV's distance values are truncated to the nearest 0.01 miles (52.8 feet). This is fine for distance, but I thought it was a serious weakness for finding % grade. It turns out that that is a problem, but not nearly as serious a problem as... well, other stuff. That will wait.
Pretending for a moment that we think MapMyRide's elevation output isn't especially good... what are we to do? As it happens, the friendly folks at NASA have the answer. In 2000 NASA conducted the Shuttle Radar Topography Mission (SRTM), obtaining elevation data for most of the Earth's surface. And that data is publicly available. Cool. You can get 1 degree x 1 degree blocks of data containing elevations at 1 arc-second intervals across the continental US, and 3 arc-second intervals across most of the remainder of the world. One arc-second in our neighborhood is roughly 100 feet - not bad. Given the data, all you then need is to save a GPX file from MapMyRide (or use your Garmin output), convert to CSV using GPSBabel, then get an egghead like yours truly to write a routine that retrieves an elevation given a latitude and longitude. The result is shown in the red curve below. (Actually, the red curve is a bilinear interpolation from the table, though it turns out that simply picking the closest point from the table isn't terribly wrong, at least in the case of the Vicksburg Military Park).
Pretty decent agreement between the two. I'm not sure where MapMyRide gets elevation data; my guess is it also uses the SRTM data and has supplemental information for roads. But I may be wrong. One obvious problem with relying solely on the SRTM data: say you're crossing a bridge over a gap where the ground surface is - pick a number - 200 feet below, and the bridge passes right through the center of a 1 arc-second square, with no point on the bridge close to a corner of that square. Whether you pick the closest point from the data or use some sort of interpolation, the elevation you get using the SRTM data will be low. To back that up, take a look at miles 7.5 (bridge at the bottom of Ft. Hill) and 11 (bridge over Jackson Rd, just before Big Mama). Maybe I'm just incredibly lucky, but in this case I think I might actually be correct :-) You would also have the same, but opposite, problem riding through a large cut with relatively steep sides.
What about % grade? Glad you asked... using, once again,
everyone's favorite graph software, we can differentiate elevation vs.
distance to get grade vs. distance. The results:
At first glance the MapMyRide data appears more realistic: I don't believe Ft. Hill is a 20% climb, nor do I believe there are any 16% descents in the park. But again, I think this is likely a limitation of the SRTM data and the bogus elevation values we get while crossing bridges.
I'm still not really happy with MapMyRide's elevation output being limited to 0.01 miles precision in the distance field, but for now, at least, this is the best elevation-getting-gizmo I've come up with. Next: Ergomo. Assuming Bo buys me one :-)
Map loaded by GPX Loader Author: Bryce Nesbitt, Revision: October 2005, Licence: Freeware