You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.4KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset=utf-8 />
  5. <title>Mapero</title>
  6. <script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
  7. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.css" />
  8. <style>
  9. body { margin:0; padding:0; }
  10. #map {width: 100%;height: 280px;}
  11. </style>
  12. </head>
  13. <body>
  14. <div id='map'></div>
  15. <?php
  16. if ($_REQUEST[lat] !='') {$lat=$_REQUEST[lat];}else {$lat= "-75.5570125579834";}
  17. if ($_REQUEST[lon] !='') {$lon=$_REQUEST[lon];}else {$lon= "6.2463742841860";}
  18. if ($_REQUEST[zoom] !='') {$zoom=$_REQUEST[zoom];}else {$zoom= "16";}
  19. ?>
  20. <script>
  21. var map = L.map('map')
  22. .setView([<?php echo $lon ?>, <?php echo $lat ?>], <?php echo $zoom ?>);
  23. L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
  24. //var lat = window.parent.document.getElementById('lat');
  25. //var lng = window.parent.document.getElementById('lon');
  26. var mapa = window.parent.document.getElementById('<?php echo $_REQUEST[id]?>');
  27. var marker = L.marker([<?php echo $lon ?>,<?php echo $lat ?>],{draggable: true}).addTo(map);
  28. // every time the marker is dragged, update the coordinates container
  29. marker.on('dragend', ondragend);
  30. // Set the initial marker coordinate on load.
  31. ondragend();
  32. function ondragend() {
  33. var m = marker.getLatLng();
  34. var z = map.getZoom();
  35. // lat.value= m.lat;
  36. // lng.value= m.lng;
  37. mapa.value= m.lng+' '+m.lat+' '+z;
  38. }
  39. </script>
  40. </body>
  41. </html>