milfs/mapa.php

143 lines
3.8 KiB
PHP
Raw Permalink Normal View History

2014-09-25 15:46:41 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
2018-10-09 14:33:15 +00:00
<title></title>
2014-09-25 15:46:41 +00:00
2018-10-09 14:33:15 +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
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
2018-10-10 14:17:02 +00:00
2020-04-06 21:58:18 +00:00
2018-10-09 14:33:15 +00:00
<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>
2018-10-10 14:17:02 +00:00
-->
2020-04-06 21:58:18 +00:00
<script src="js/scripts.js"></script>
2018-10-10 14:17:02 +00:00
<link rel="stylesheet" href="librerias/leaflet/leaflet.css"/>
<script src="librerias/leaflet/leaflet.js"></script>
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>
2020-04-06 21:58:18 +00:00
<?php
2020-04-06 22:32:05 +00:00
sleep(2);
2020-04-06 21:58:18 +00:00
$ubicacion = $_COOKIE['ubicacion'];
$coordenadas = explode("|",$ubicacion);
if($coordenadas[0] !="" AND $coordenadas[1] !="" ){
$lon = $coordenadas[0];
$lat = $coordenadas[1];
$zoom = "20";
}else{
2018-10-09 14:33:15 +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= "20";}
2020-04-06 21:58:18 +00:00
}
2014-09-25 15:46:41 +00:00
?>
2020-04-06 21:58:18 +00:00
2014-09-25 15:46:41 +00:00
<script>
2020-04-06 21:58:18 +00:00
//var e.latlng= localizacion;
//alert(localizacion);
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);
2018-10-27 17:39:19 +00:00
2020-04-06 21:58:18 +00:00
<?php
if(!isset($_REQUEST['exif'])) { ?>
2020-04-06 21:58:18 +00:00
function onLocationFound(e) {
2018-10-10 14:51:13 +00:00
//var radius = e.accuracy / 2;
var marker = L.marker(e.latlng,{draggable: true}).addTo(map);
var mapa = window.parent.document.getElementById("<?php echo $_REQUEST[id] ?>");
2018-10-27 17:39:19 +00:00
mapa.value= '<?php echo "$lon $lat $zoom"; ?>';
marker.on('dragend', ondragend);
ondragend();
2018-10-27 17:39:19 +00:00
map.setZoom(<?php echo $zoom; ?>);
var m = marker.getLatLng();
mapa.value= m.lng+' '+m.lat+' <?php echo $zoom; ?>';
2020-04-06 21:58:18 +00:00
2018-10-27 17:39:19 +00:00
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
2018-10-27 17:39:19 +00:00
2020-04-06 21:58:18 +00:00
2018-10-27 17:39:19 +00:00
map.setZoom(z);
2020-04-06 21:58:18 +00:00
2018-10-27 17:39:19 +00:00
mapa.value= m.lng+' '+m.lat+' '+z;
}
}
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();
2018-10-10 14:51:13 +00:00
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
2018-10-10 14:51:13 +00:00
mapa.value= m.lng+' '+m.lat+' '+z;
}
}
map.on('locationerror', onLocationError);
2018-10-10 14:51:13 +00:00
map.on('locationfound', onLocationFound);
2018-10-27 17:39:19 +00:00
map.locate({setView: true, maxZoom: 20});
2018-10-10 14:51:13 +00:00
<?php }else{ ?>
2020-04-06 21:58:18 +00:00
2018-10-10 14:51:13 +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]?>');
marker.on('dragend', ondragend);
ondragend();
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
mapa.value= m.lng+' '+m.lat+' '+z;
}
2020-04-06 21:58:18 +00:00
2018-10-10 14:51:13 +00:00
<?php } ?>
//var lat = window.parent.document.getElementById('lat');
//var lng = window.parent.document.getElementById('lon');
//var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
2014-09-25 15:46:41 +00:00
//var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
2014-09-25 15:46:41 +00:00
// every time the marker is dragged, update the coordinates container
//marker.on('dragend', ondragend);
2014-09-25 15:46:41 +00:00
// Set the initial marker coordinate on load.
//ondragend();
2014-09-25 15:46:41 +00:00
/*
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
2014-09-25 15:46:41 +00:00
// lat.value= m.lat;
// lng.value= m.lng;
mapa.value= m.lng+' '+m.lat+' '+z;
}*/
2014-09-25 15:46:41 +00:00
</script>
2020-04-06 22:32:05 +00:00
2014-09-25 15:46:41 +00:00
</body>
2018-10-09 14:33:15 +00:00
</html>