Created
April 14, 2016 08:32
-
-
Save Gaiiden/d5303fc64442601b73cb415944821393 to your computer and use it in GitHub Desktop.
renders ascent profiles (or any path really)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clearscreen. | |
set pathData to readjson("path.json"). | |
set colorList to list(green, red, cyan, purple, yellow, blue). | |
set colorListIndex to -1. | |
set lastPhase to "". | |
clearvecdraws(). | |
from { local index is 0. } until index = pathData["geo"]:length-1 step { set index to index + 1. } do { | |
if pathData["phase"][index] <> lastPhase { | |
set lastPhase to pathData["phase"][index]. | |
set colorListIndex to colorListIndex + 1. | |
if colorListIndex = colorList:length set colorListIndex to 0. | |
} | |
vecdraw(latlng(pathData["geo"][index]:lat, pathData["geo"][index]:lng):altitudeposition(pathData["alt"][index]), | |
pathData["vec"][index] + (latlng(pathData["geo"][index+1]:lat, pathData["geo"][index+1]:lng):altitudeposition(pathData["alt"][index+1]) - latlng(pathData["geo"][index]:lat, pathData["geo"][index]:lng):altitudeposition(pathData["alt"][index])), | |
colorList[colorListIndex], | |
"", | |
1.0, | |
true, | |
100). | |
}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment