27.11.2011, 12:42
(This post was last modified: 27.11.2011, 12:43 by routeconverter.)
(24.11.2011, 22:39)hiviking Wrote: I just decided to write an awk script that does the conversion. Without missing any timestamps, that is, so it definitely can be done. It took me about an hour to get it right.
Can you provide two example files to me: the original KML file and the GPX file your awk script generates? I think RouteConverter converts elevation information from KML files but I cannot extract from your awk script what is different there.
(24.11.2011, 22:39)hiviking Wrote: While I was at it I wrote another script to get the Google elevations via their Elevation Service, so I am now independent of "3D Route Builder".
I've double checked RouteConverters code to extract the elevation from the downloaded SRTM 3 data. It does an interpolation as you can see here in the code:
Quote: double dDeltaLat; // The delta between top lat value and wanted lat (delta within a sub tile)
double dDeltaLon; // The delta between left lon value and wanted lon (delta within a sub tile)
dDeltaLon = dOffLon - (double) nLonIndex * (1.0 / (double) nAS); // The delta (offset) from left point to wanted point
dDeltaLat = dOffLat - (double) nLatIndex * (1.0 / (double) nAS); // The delta (offset) from bottom point to wanted point
double dLonHeightLeft; // The interpolated elevation calculated from left top to left bottom
double dLonHeightRight; // The interpolated elevation calculated from right top to right bottom
dLonHeightLeft = dLeftBottom - calculateElevation(dLeftBottom - dLeftTop, 1.0 / (double) nAS, dDeltaLat);
dLonHeightRight = dRightBottom - calculateElevation(dRightBottom - dRightTop, 1.0 / (double) nAS, dDeltaLat);
// Interpolate between the interpolated left elevation and interpolated right elevation
dElevation = dLonHeightLeft - calculateElevation(dLonHeightLeft - dLonHeightRight, 1.0 / (double) nAS, dDeltaLon);
return (int) (dElevation + 0.5); // Do a rounding of the calculated elevation
You can think of a different more precise interpolation algorithm or has Google simply more or more accurate data?
--
Christian
Christian
