correciones para mapa.php

This commit is contained in:
fredyrivera 2017-09-25 15:23:09 -05:00
parent 198249d5ab
commit 88d4a4c63d

View File

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<meta charset=utf-8 /> <meta charset=utf-8 />
<title>Display latitude longitude on marker movement</title> <title>Mapa tupale.co</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
@ -43,7 +43,7 @@ var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
var z = map.getZoom(); var z = map.getZoom();
mapa.value= m.lng+' '+m.lat+' '+z; mapa.value= m.lng+' '+m.lat+' '+z;
} }
//map.on('locationfound', onLocationFound);
} }
map.on('locationfound', onLocationFound); map.on('locationfound', onLocationFound);
function onLocationError(e) { function onLocationError(e) {
@ -68,35 +68,19 @@ map.on('locationerror', onLocationError);
var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map); var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>'); var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>); map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
// map.locate({setView: true, maxZoom: 16}); marker.on('dragend', ondragend);
ondragend();
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
mapa.value= m.lng+' '+m.lat+' '+z;
}
<?php }?> <?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]?>');
//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> </script>