mejoras en el campo mapa
This commit is contained in:
parent
24d2a436db
commit
7f27c1280d
36
mapa.php
36
mapa.php
@ -41,11 +41,11 @@ var map = L.map('map')
|
|||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
||||||
<?php
|
<?php
|
||||||
if(!isset($_REQUEST['exif'])) { ?>
|
if(!isset($_REQUEST['exif'])) { ?>
|
||||||
|
|
||||||
function onLocationFound(e) {
|
function onLocationFound(e) {
|
||||||
var radius = e.accuracy / 2;
|
//var radius = e.accuracy / 2;
|
||||||
var marker = L.marker(e.latlng,{draggable: true}).addTo(map)
|
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 mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|
||||||
|
|
||||||
marker.on('dragend', ondragend);
|
marker.on('dragend', ondragend);
|
||||||
ondragend();
|
ondragend();
|
||||||
@ -56,26 +56,36 @@ var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
map.on('locationfound', onLocationFound);
|
|
||||||
|
|
||||||
<?php } ?>
|
|
||||||
function onLocationError(e) {
|
function onLocationError(e) {
|
||||||
//alert(e.message);
|
//alert(e.message);
|
||||||
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]?>');
|
||||||
marker.on('dragend', ondragend);
|
marker.on('dragend', ondragend);
|
||||||
ondragend();
|
ondragend();
|
||||||
function ondragend() {
|
function ondragend() {
|
||||||
var m = marker.getLatLng();
|
var m = marker.getLatLng();
|
||||||
var z = map.getZoom();
|
var z = map.getZoom();
|
||||||
mapa.value= m.lng+' '+m.lat+' '+m.z;
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
map.on('locationerror', onLocationError);
|
map.on('locationerror', onLocationError);
|
||||||
map.locate({setView: true, maxZoom: 16});
|
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);
|
||||||
|
ondragend();
|
||||||
|
function ondragend() {
|
||||||
|
var m = marker.getLatLng();
|
||||||
|
var z = map.getZoom();
|
||||||
|
mapa.value= m.lng+' '+m.lat+' '+z;
|
||||||
|
}
|
||||||
|
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
|
||||||
//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]?>');
|
||||||
|
Loading…
Reference in New Issue
Block a user