// Build the route URL urlRoute0 = './application/helpers/prefetch.route.php?r=btr1002025_track.geojson&light='+slowMobileConnection+'&fingerprint=G4RyPvaGDBLIUPuGHaentZNUBFWlmCPl_mod_1746706289'; // Add GeoJSON Source if not yet added. if (!map.getSource('route0')) { map.addSource('route0', { type: 'geojson', data: urlRoute0 }); } // Add Route Layer if not yet added. if (!map.getLayer('route0')) { map.addLayer({ "id": "route0", "type": "line", "source": "route0", "layout": { "line-join": "round", "line-cap": "round" }, "paint": { "line-color": "#551a8b", "line-width": 3 } }); } // Add Direction Arrow Layer if not yet added. if (!map.getLayer('arrow-layer0')) { map.addLayer({ 'id': 'arrow-layer0', 'type': 'symbol', 'source': 'route0', 'layout': { 'symbol-placement': 'line', 'symbol-spacing': 200, 'icon-allow-overlap': true, 'icon-image': 'route-direction-arrow', 'icon-size': 0.3, 'visibility': 'visible' }, 'paint': { 'icon-color': '#551a8b' } }); }