107 lines
3.0 KiB
PHP
107 lines
3.0 KiB
PHP
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset=utf-8 />
|
|
<title></title>
|
|
|
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
|
|
|
|
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"
|
|
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
|
|
crossorigin=""/>
|
|
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"
|
|
integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA=="
|
|
crossorigin=""></script>
|
|
-->
|
|
|
|
<link rel="stylesheet" href="librerias/leaflet/leaflet.css"/>
|
|
<script src="librerias/leaflet/leaflet.js"></script>
|
|
<style>
|
|
body { margin:0; padding:0; }
|
|
#map {width: 100%;height: 280px;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
|
|
|
|
<div id='map'></div>
|
|
<?php
|
|
if ($_REQUEST['lat'] !='') {$lat=$_REQUEST['lat'];}else {$lat= "-72";}
|
|
if ($_REQUEST['lon'] !='') {$lon=$_REQUEST['lon'];}else {$lon= "4";}
|
|
if ($_REQUEST['zoom'] !='') {$zoom=$_REQUEST['zoom'];}else {$zoom= "20";}
|
|
|
|
?>
|
|
<script>
|
|
var map = L.map('map')
|
|
.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
|
<?php
|
|
if(!isset($_REQUEST['exif'])) { ?>
|
|
function onLocationFound(e) {
|
|
var radius = e.accuracy / 2;
|
|
var marker = L.marker(e.latlng,{draggable: true}).addTo(map)
|
|
L.circle(e.latlng, radius).addTo(map);
|
|
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
|
|
marker.on('dragend', ondragend);
|
|
ondragend();
|
|
function ondragend() {
|
|
var m = marker.getLatLng();
|
|
var z = map.getZoom();
|
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
map.on('locationfound', onLocationFound);
|
|
|
|
<?php } ?>
|
|
function onLocationError(e) {
|
|
//alert(e.message);
|
|
var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
|
|
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
marker.on('dragend', ondragend);
|
|
ondragend();
|
|
function ondragend() {
|
|
var m = marker.getLatLng();
|
|
var z = map.getZoom();
|
|
mapa.value= m.lng+' '+m.lat+' '+m.z;
|
|
}
|
|
}
|
|
map.on('locationerror', onLocationError);
|
|
map.locate({setView: true, maxZoom: 16});
|
|
//var lat = window.parent.document.getElementById('lat');
|
|
//var lng = window.parent.document.getElementById('lon');
|
|
//var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
|
|
//var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
|
|
|
|
|
|
|
|
// every time the marker is dragged, update the coordinates container
|
|
//marker.on('dragend', ondragend);
|
|
|
|
// Set the initial marker coordinate on load.
|
|
//ondragend();
|
|
|
|
/*
|
|
function ondragend() {
|
|
var m = marker.getLatLng();
|
|
var z = map.getZoom();
|
|
|
|
// lat.value= m.lat;
|
|
// lng.value= m.lng;
|
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
|
}*/
|
|
</script>
|
|
|
|
|
|
</body>
|
|
</html>
|