corrección bug mapa

This commit is contained in:
humano 2015-02-26 11:09:09 -05:00
parent 0368342837
commit 7f80af499d

45
milfs/mapa.php Normal file → Executable file
View File

@ -12,43 +12,11 @@
#map {width: 100%;height: 280px;} #map {width: 100%;height: 280px;}
</style> </style>
</head> </head>
<body onload="javascript:window.parent.document.getElementById('<?php echo $_REQUEST[id]?>').value= '';"> <body>
<div id='map'></div> <div id='map'></div>
<script type='text/javascript'>
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
});
/* var map = L.map('map')
L.tileLayer('http://{s}.tile.cloudmade.com/1cc75fcc8e2243d1b2f6aab1e5850be1/998/256/{z}/{x}/{y}.png', {
attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
}).addTo(map);
*/
// map.locate({setView: true, maxZoom: 16});
/* function onLocationFound(e) {
var radius = e.accuracy / 2;
L.marker(e.latlng).addTo(map)
.bindPopup("You are within " + radius + " meters from this point").openPopup();
L.circle(e.latlng, radius).addTo(map);
}
map.on('locationfound', onLocationFound);
*/
}
</script>
<?php <?php
if ($_REQUEST[lat] !='') {$lat=$_REQUEST[lat];}else {$lat= "-75.5570125579834";} if ($_REQUEST[lat] !='') {$lat=$_REQUEST[lat];}else {$lat= "-75.5570125579834";}
if ($_REQUEST[lon] !='') {$lon=$_REQUEST[lon];}else {$lon= "6.2463742841860";} if ($_REQUEST[lon] !='') {$lon=$_REQUEST[lon];}else {$lon= "6.2463742841860";}
@ -56,17 +24,13 @@
?> ?>
<script> <script>
var map = L.map('map') var map = L.map('map')
// .setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>); .setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
.setView([latitude, longitude], <?php echo $zoom ?>);
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
//var lat = window.parent.document.getElementById('lat'); //var lat = window.parent.document.getElementById('lat');
//var lng = window.parent.document.getElementById('lon'); //var lng = window.parent.document.getElementById('lon');
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
//var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
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);
@ -85,8 +49,7 @@ function ondragend() {
// lat.value= m.lat; // lat.value= m.lat;
// lng.value= m.lng; // lng.value= m.lng;
//mapa.value= m.lng+' '+m.lat+' '+z; mapa.value= m.lng+' '+m.lat+' '+z;
window.parent.document.getElementById('<?php echo $_REQUEST[id]?>').value= m.lng+' '+m.lat+' '+z;
} }
</script> </script>