1
0
forked from qwerty/milfs
milfskleper/milfs/mapa.php

59 lines
1.5 KiB
PHP
Raw Normal View History

2014-09-25 15:46:41 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Display latitude longitude on marker movement</title>
<script src="https://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
2014-09-25 15:46:41 +00:00
<link rel="stylesheet" href="https://cdn.leafletjs.com/leaflet-0.7/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
if ($_REQUEST[lat] !='') {$lat=$_REQUEST[lat];}else {$lat= "-75.5570125579834";}
if ($_REQUEST[lon] !='') {$lon=$_REQUEST[lon];}else {$lon= "6.2463742841860";}
if ($_REQUEST[zoom] !='') {$zoom=$_REQUEST[zoom];}else {$zoom= "16";}
?>
<script>
var map = L.map('map')
2015-02-26 16:09:09 +00:00
.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
2014-09-25 15:46:41 +00:00
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
//var lat = window.parent.document.getElementById('lat');
//var lng = window.parent.document.getElementById('lon');
2015-02-26 16:09:09 +00:00
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);
// 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;
2015-02-26 16:09:09 +00:00
mapa.value= m.lng+' '+m.lat+' '+z;
2014-09-25 15:46:41 +00:00
}
</script>
</body>
</html>