Corrected verify map

This commit is contained in:
Samuel Ortion 2021-03-29 12:56:03 +02:00
parent afbc3ed382
commit 371d12af32
5 changed files with 20 additions and 21 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
public/storage

Binary file not shown.

View File

@ -1,18 +1,19 @@
let span = document.getElementById('latlng');
let coordinates = span.innerHTML;
lat = coordinates.split(",")[0];
lng = coordinates.split(",")[1];
let latlng = L.LatLng(lat, lng);
var mymap = L.map('checkmap').setView([lat, lng], 13);
if (typeof coordinates !== 'undefined') {
lat = coordinates.split(",")[0];
lng = coordinates.split(",")[1];
let latlng = L.LatLng(lat, lng);
let marker = L.marker(latlng, draggable=false).addTo(mycheckmap);
let mycheckmap = L.map('checkmap').setLatLng(latlng);
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXQwNDl5MTBtc2gybm82b3c0M3VoNncifQ.qUqAuCuMDF38NcyrAC1RJQ'
}).addTo(mycheckmap);
}
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXVmanF1bzEwd2Mybm82Nzlobm42bHAifQ.fKY7fUnY-MpzZUcseao0zg'
}).addTo(mymap);
let marker = L.marker([lat, lng], draggable=false).addTo(mymap);

View File

@ -5,7 +5,7 @@ L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_toke
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1,
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXQwNDl5MTBtc2gybm82b3c0M3VoNncifQ.qUqAuCuMDF38NcyrAC1RJQ'
accessToken: 'pk.eyJ1IjoidW5jbGVzYW11bHVzIiwiYSI6ImNrbXVmanF1bzEwd2Mybm82Nzlobm42bHAifQ.fKY7fUnY-MpzZUcseao0zg'
}).addTo(mymap);
var marker = L.marker([0, 0], draggable=true).addTo(mymap);
@ -26,4 +26,3 @@ function onMapClick(e) {
}
mymap.on('click', onMapClick);

View File

@ -55,7 +55,7 @@
</tr>
</tbody></table>
<h2>Location</h2>
<span id="latlng"><?=$_SESSION['observation']['latlng']?></span>
<div id="checkmap" style="height: 250px; border: 1px solid #AAA;"></div>
<script type='text/javascript' src='/scripts/jquery/script.js'></script>
@ -63,10 +63,8 @@
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""></script>
<script src="scripts/checkmap.js">
let coordinates = <?= $_SESSION['observation']['latlng']?>;
</script>
<form action="submitobservation" method="post">
<input type="checkbox" id="allok" name="allok">
<label for="allok">All informations are ok.</label><br>