async function ulozNovuCestu(points) { try { const response = await fetch( "track.php", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ points: points }) } ); const data = await response.json(); console.log( "Track uložený:", data ); } catch (error) { console.error( "Chyba pri ukladaní tracku:", error ); } } function vykresliMapu() { vycistiCanvas(); vykresliOSMCesty(); vykresliTracks(); vykresliTrasu(); vykresliGPS(); } function vykresliTrack(track) { if (track.points.length < 2) { return; } ctx.beginPath(); track.points.forEach((point, i) => { const p = gpsToCanvas( point.lon, point.lat ); if (i === 0) { ctx.moveTo(p.x, p.y); } else { ctx.lineTo(p.x, p.y); } }); ctx.lineWidth = 4; ctx.setLineDash([10, 6]); ctx.strokeStyle = "#8B4513"; ctx.stroke(); ctx.setLineDash([]); }