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.

55 lines
1.5 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  5. <title>Denunction Map</title>
  6. <meta name="viewport" content="initial-scale=1.0">
  7. <meta charset="utf-8">
  8. <style>
  9. #map {
  10. height: 100%;
  11. }
  12. html, body {
  13. height: 100%;
  14. margin: 0;
  15. padding: 0;
  16. }
  17. </style>
  18. </head>
  19. <body>
  20. <div id="map"></div>
  21. <script>
  22. var map;
  23. function initMap() {
  24. map = new google.maps.Map(document.getElementById('map'), {
  25. center: {lat: 39.92, lng: 32.85},
  26. zoom: 13
  27. });
  28. }
  29. </script>
  30. <script>
  31. var markers = [];
  32. setInterval(function() {
  33. for (var i = 0; i < markers.length; i++) {
  34. markers[i].setMap(null);
  35. }
  36. $.get("https://127.0.0.1:5000/denunciations", function(data, status){
  37. if (status == "success") {
  38. data.forEach(function(element) {
  39. var marker = new google.maps.Marker({
  40. position: { lat: element["location"]["latitude"], lng: element["location"]["longitude"]},
  41. map: map,
  42. label: element["priority"].toString(),
  43. title: element["info"]
  44. });
  45. markers.push(marker);
  46. });
  47. }
  48. });
  49. }, 5000);
  50. </script>
  51. <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBuOC03IHPA_6TPnfk18b0SAgD1uge4-dk&callback=initMap"
  52. async defer></script>
  53. </body>
  54. </html>