From 7f27c1280d1352ff7518945457b9278fbf53fab3 Mon Sep 17 00:00:00 2001 From: humano Date: Wed, 10 Oct 2018 09:51:13 -0500 Subject: [PATCH] mejoras en el campo mapa --- mapa.php | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/mapa.php b/mapa.php index 99a374d..115959e 100644 --- a/mapa.php +++ b/mapa.php @@ -41,11 +41,11 @@ var map = L.map('map') L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map); + 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(''); + //var radius = e.accuracy / 2; + var marker = L.marker(e.latlng,{draggable: true}).addTo(map); + var mapa = window.parent.document.getElementById(""); marker.on('dragend', ondragend); ondragend(); @@ -56,26 +56,36 @@ var mapa = window.parent.document.getElementById(''); } } - - - - map.on('locationfound', onLocationFound); - - function onLocationError(e) { //alert(e.message); var marker = L.marker([,],{draggable: true}).addTo(map); var mapa = window.parent.document.getElementById(''); marker.on('dragend', ondragend); ondragend(); - function ondragend() { +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}); + map.on('locationfound', onLocationFound); + map.locate({setView: true, maxZoom: 16}); + + + var marker = L.marker([,],{draggable: true}).addTo(map); + var mapa = window.parent.document.getElementById(''); + marker.on('dragend', ondragend); + ondragend(); + function ondragend() { + var m = marker.getLatLng(); + var z = map.getZoom(); + mapa.value= m.lng+' '+m.lat+' '+z; + } + + + + //var lat = window.parent.document.getElementById('lat'); //var lng = window.parent.document.getElementById('lon'); //var mapa = window.parent.document.getElementById('');