Skip to content

Instantly share code, notes, and snippets.

@330k
Last active October 2, 2022 13:46
Show Gist options
  • Save 330k/ce8e1677ecb7849ceab375f022b90822 to your computer and use it in GitHub Desktop.
Save 330k/ce8e1677ecb7849ceab375f022b90822 to your computer and use it in GitHub Desktop.
var map = Routes.activeMap, route = map.activeRoute, trackpoints = route.trackPoints(), update = () => {
if(trackpoints.length === trackpoints.filter((e)=>(e.roadEnv!==undefined)).length){
route.rebuildBounds();
route.flattenBridgesAndTunnels();
route.calculateMetrics();
map.loadElevationProfile();
console.log("完了");
}else{
setTimeout(update, 1000);
}
};
map.injectSurfaces(trackpoints, () => {console.log("ERROR");});
map.fetchElevations(trackpoints, update, () => {console.log("ERROR");});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment