2014-09-25 15:46:41 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta charset=utf-8 />
|
2018-07-01 22:21:48 +00:00
|
|
|
<title>Mapa tupale.co</title>
|
2014-09-25 15:46:41 +00:00
|
|
|
|
2015-07-10 13:00:51 +00:00
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
|
2014-09-25 15:46:41 +00:00
|
|
|
|
2015-07-10 13:00:51 +00:00
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
|
2014-09-25 15:46:41 +00:00
|
|
|
<style>
|
|
|
|
body { margin:0; padding:0; }
|
|
|
|
#map {width: 100%;height: 280px;}
|
|
|
|
</style>
|
|
|
|
</head>
|
2015-02-26 16:09:09 +00:00
|
|
|
<body>
|
2014-09-25 15:46:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div id='map'></div>
|
|
|
|
<?php
|
2018-07-01 22:21:48 +00:00
|
|
|
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= "18";}
|
2014-09-25 15:46:41 +00:00
|
|
|
|
2018-07-01 22:21:48 +00:00
|
|
|
if($zoom <1) {$zoom ='12';}
|
2014-09-25 15:46:41 +00:00
|
|
|
?>
|
|
|
|
<script>
|
2018-07-01 22:21:48 +00:00
|
|
|
var map = L.map('map').setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
|
2015-07-10 13:00:51 +00:00
|
|
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
2018-07-01 22:21:48 +00:00
|
|
|
<?php
|
|
|
|
if(!isset($_REQUEST['exif'])) { ?>
|
|
|
|
|
|
|
|
function onLocationFound(e) {
|
2015-08-13 12:01:18 +00:00
|
|
|
var radius = e.accuracy / 2;
|
|
|
|
var marker = L.marker(e.latlng,{draggable: true}).addTo(map)
|
2018-07-01 22:21:48 +00:00
|
|
|
L.circle(e.latlng, radius).addTo(map);
|
|
|
|
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
|
|
//var m = e.latlng;
|
|
|
|
map.setView([e.latlng.lat,e.latlng.lng], <?php echo $zoom ?>);
|
2015-08-13 12:01:18 +00:00
|
|
|
marker.on('dragend', ondragend);
|
|
|
|
ondragend();
|
2018-07-01 22:21:48 +00:00
|
|
|
//var z = 12;
|
2015-08-13 12:01:18 +00:00
|
|
|
function ondragend() {
|
|
|
|
var m = marker.getLatLng();
|
|
|
|
var z = map.getZoom();
|
2018-07-01 22:21:48 +00:00
|
|
|
if (z < '1' ) { var z = '12' ; }
|
2015-08-13 12:01:18 +00:00
|
|
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
2018-07-01 22:21:48 +00:00
|
|
|
}
|
|
|
|
|
2015-08-13 12:01:18 +00:00
|
|
|
}
|
2018-07-01 22:21:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function onLocationError(e) {
|
|
|
|
|
|
|
|
|
2015-08-13 12:01:18 +00:00
|
|
|
var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
|
2018-07-01 22:21:48 +00:00
|
|
|
//var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
2015-08-13 12:01:18 +00:00
|
|
|
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
2018-07-01 22:21:48 +00:00
|
|
|
map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
|
2015-08-13 12:01:18 +00:00
|
|
|
marker.on('dragend', ondragend);
|
|
|
|
ondragend();
|
|
|
|
function ondragend() {
|
|
|
|
var m = marker.getLatLng();
|
|
|
|
var z = map.getZoom();
|
|
|
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
2018-07-01 22:21:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
map.on('locationfound', onLocationFound);
|
|
|
|
map.on('locationerror', onLocationError);
|
2014-09-25 15:46:41 +00:00
|
|
|
|
|
|
|
|
2018-07-01 22:21:48 +00:00
|
|
|
map.locate({setView: true, maxZoom: 16});
|
|
|
|
|
|
|
|
<?php } else{?>
|
2014-09-25 15:46:41 +00:00
|
|
|
|
|
|
|
|
2018-07-01 22:21:48 +00:00
|
|
|
var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
|
|
|
|
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
|
|
|
|
|
|
map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
|
|
|
|
marker.on('dragend', ondragend);
|
|
|
|
ondragend();
|
|
|
|
function ondragend() {
|
|
|
|
var m = marker.getLatLng();
|
|
|
|
var z = map.getZoom();
|
|
|
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
|
|
|
}
|
2014-09-25 15:46:41 +00:00
|
|
|
|
|
|
|
|
2018-07-01 22:21:48 +00:00
|
|
|
<?php }?>
|
2014-09-25 15:46:41 +00:00
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
2015-08-13 12:01:18 +00:00
|
|
|
</html>
|