CubeTrek is a free and open-source web app to visualize, share and manage your GPS tracks (see the full repo at github.com/r-follador/cubetrek)
One of its main features is the ability to show a 3-dimensional topographic model of the area with the GPS track overlaid.
rotating5.mp4
The amazing Babylon.js library is used to render the models and handle the user interactions on the front end.
CubeTrek can use some creative input on how to improve the user experience, make it easier to interact with the topographical model, add some cool effects or whatever other ideas you have.
The idea is to bring any advancements from this repo to the CubeTrek main repo, for everyone to use.
The CubeTrek backend handles the dynamic aspects of generating the 3D model (a GLTF file), preparing GeoJSON data, serving the map textures and producing a list of nearby peaks; all the parts required for the final Babylon.js scene.
To make it easier to work on the Babylon.js (and other JavaScript) code, this repo provides three GPS tracks statically, with all the required files:
- St. Moritz run
- Cima di Fiorina
- Chicago Run
By the way, there are loads of other examples on Cubetrek.com, you can also upload your own GPS tracks.
- Clone the repo:
git clone https://github.com/r-follador/CubeTrek_Babylon - Create your own branch
git checkout -b my-beautiful-new-branch(use a cooler branch name) - Because the javascripts use modules, if you try to load the HTML file locally (i.e. with a file:// URL), you'll run into CORS errors due to JavaScript module security requirements. You need to do your testing through a server. It's best to use some type of IDE (IntelliJ, Visual Studio Code) anyway.
- Get started by modifying the Babylon.js script in js/map3d.js.
- Commit and push your branch to origin (
git push -u origin my-beautiful-new-branch)
- Main HTML files (as mentioned above)
- JavaScript (in ./js)
- main.js: starting point, loading all modules
- map3d.js: <-- this is where the CubeTrek.js magic happens!
- map2d.js: the auxiliary 2D map on the bottom right (powered by MapLibre GL JS)
- graph.js: the statistic graph on the top right (powered by D3.js)
- EventBus.js: connecting the Babylon map, the Maplibre map and the statistics graph on mouse hover
- some other files...
- Usually generated on the fly from the CubeTrek server, but provided statically in this sandbox (in ./api):
- ./api/gltf/*.gltf the GLTF files
- ./api/gltf/map////.png the textures; either as map or as satellite pictures
- ./api/geojson/*.json the geojson containing the lat/lon GPS points, timing data and some additional info
- ./api/peaks/* a json containing a list of nearby peaks