33 lines
914 B
JavaScript
33 lines
914 B
JavaScript
|
|
|
|
|
|
|
|
var map = L.map('map').setView([49.41607523, 8.672200499], 19);
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
|
maxZoom: 44,
|
|
attribution: '© OpenStreetMap'
|
|
}).addTo(map);
|
|
|
|
// helper function for displayRoute()
|
|
async function prepare(){
|
|
var allcoordinates = getAllCoordinates('coordinates');
|
|
return allcoordinates;
|
|
}
|
|
|
|
async function displayRoute() {
|
|
var allcoordinates = await prepare();
|
|
console.log(allcoordinates);
|
|
//var marker = L.marker([49.41607523,8.67220049]).addTo(map);
|
|
var polyline = L.polyline(allcoordinates, {color: 'red'}).addTo(map);
|
|
map.fitBounds(polyline.getBounds());
|
|
map.fitBounds(polyline.getBounds());
|
|
}
|
|
|
|
async function showBike(){
|
|
var current_cord = await getCurrentCoordinate()
|
|
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
|
L.marker(current_cord).addTo(map)
|
|
.bindPopup(' Your BIKE!')
|
|
.openPopup();
|
|
}
|