correciones para mapa.php

This commit is contained in:
fredyrivera 2017-09-25 14:39:39 -05:00
parent a28b443a98
commit 198249d5ab
2 changed files with 25 additions and 15 deletions

View File

@ -4268,7 +4268,7 @@ foreach ($geocoder as $clave => $valor) {
$pais = $valor['address']['country']; $pais = $valor['address']['country'];
$departamento = $valor['address']['state']; $departamento = $valor['address']['state'];
$licencia= $valor['licence']; $licencia= $valor['licence'];
$link = "milfs/mapa.php?lat=$valor[lon]&lon=$valor[lat]&zoom=16&id=$campo&localizado"; $link = "milfs/mapa.php?lat=$valor[lon]&lon=$valor[lat]&zoom=16&id=$campo&exif";
$linea .= " $linea .= "
<div onclick=\" xajax_limpia_div('muestra_geocoder'); document.getElementById('mapita').src='$link'; \" style='padding:5px; border-radius: 3px;margin:5px;border: 1px solid gray; background-color : white;'> <div onclick=\" xajax_limpia_div('muestra_geocoder'); document.getElementById('mapita').src='$link'; \" style='padding:5px; border-radius: 3px;margin:5px;border: 1px solid gray; background-color : white;'>
<ul class='list-unstyled' > <ul class='list-unstyled' >

View File

@ -2,11 +2,11 @@
<html> <html>
<head> <head>
<meta charset=utf-8 /> <meta charset=utf-8 />
<title>Tupale.co</title> <title>Display latitude longitude on marker movement</title>
<script src="../librerias/leaflet/leaflet.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<link rel="stylesheet" href="../librerias/leaflet/leaflet.css" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
<style> <style>
body { margin:0; padding:0; } body { margin:0; padding:0; }
#map {width: 100%;height: 280px;} #map {width: 100%;height: 280px;}
@ -28,7 +28,8 @@ 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 ?>);
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']) or !isset($_REQUEST['localizado'])) { ?> 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)
@ -42,18 +43,15 @@ 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);
<?php } ?>
function onLocationError(e) { function onLocationError(e) {
//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]?>');
map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
marker.on('dragend', ondragend); marker.on('dragend', ondragend);
ondragend(); ondragend();
function ondragend() { function ondragend() {
@ -62,8 +60,20 @@ function onLocationError(e) {
mapa.value= m.lng+' '+m.lat+' '+z; mapa.value= m.lng+' '+m.lat+' '+z;
} }
} }
map.on('locationerror', onLocationError);
map.locate({setView: true, maxZoom: 16}); map.on('locationerror', onLocationError);
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]?>');
map.setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
// map.locate({setView: true, maxZoom: 16});
<?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]?>');