mejoras en el campo mapa

This commit is contained in:
humano 2018-10-10 09:51:13 -05:00
parent 24d2a436db
commit 7f27c1280d

View File

@ -41,11 +41,11 @@ var map = L.map('map')
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
<?php
if(!isset($_REQUEST['exif'])) { ?>
function onLocationFound(e) {
var radius = e.accuracy / 2;
var marker = L.marker(e.latlng,{draggable: true}).addTo(map)
L.circle(e.latlng, radius).addTo(map);
var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
//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] ?>");
marker.on('dragend', ondragend);
ondragend();
@ -56,14 +56,23 @@ var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
}
}
map.on('locationfound', onLocationFound);
<?php } ?>
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();
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
mapa.value= m.lng+' '+m.lat+' '+z;
}
}
map.on('locationerror', onLocationError);
map.on('locationfound', onLocationFound);
map.locate({setView: true, maxZoom: 16});
<?php }else{ ?>
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);
@ -71,11 +80,12 @@ function onLocationError(e) {
function ondragend() {
var m = marker.getLatLng();
var z = map.getZoom();
mapa.value= m.lng+' '+m.lat+' '+m.z;
mapa.value= m.lng+' '+m.lat+' '+z;
}
}
map.on('locationerror', onLocationError);
map.locate({setView: true, maxZoom: 16});
<?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]?>');