Skip to content

Commit

Permalink
Add Preview All to geographic coverage select page
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-ide committed May 23, 2024
1 parent 558e819 commit aac61c2
Showing 1 changed file with 0 additions and 69 deletions.
69 changes: 0 additions & 69 deletions webapp/views/coverage/templates/geographic_coverage_preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@
<script src="https://maps.googleapis.com/maps/api/js?key={{ api_key }}&callback=initMap&libraries=&v=weekly" async></script>
<script>

function allCoordsSame(coords) {
if (coords.length > 0) {
const first = coords[0];
return coords.every(coord => coord.lat() === first.lat() && coord.lng() === first.lng());
}
return true;
}

function initMap() {

// Create the map
Expand Down Expand Up @@ -74,67 +66,6 @@

window.onload = initMap;



{##}
{##}
{#function initMap() {#}
{# alert("{{ bounding_boxes }}");#}
{# setTimeout(function() {#}
{##}
{# {% for coordinates in bounding_boxes %}#}
{# alert("{{ coordinates }}");#}
{##}
{# const mapCenter = { lat: {{ coordinates[0][0] }}, lng: {{ coordinates[0][1] }} };#}
{# const map = new google.maps.Map(document.getElementById("map"), {#}
{# zoom: 10,#}
{# center: mapCenter,#}
{# });#}
{##}
{# const polygonCoords = [#}
{# {% for lat, lng in coordinates %}#}
{# new google.maps.LatLng({{ lat }}, {{ lng }}),#}
{# {% endfor %}#}
{# ];#}
{##}
{# if (polygonCoords.length == 1 || allCoordsSame(polygonCoords)) {#}
{# map.setCenter(polygonCoords[0]);#}
{# new google.maps.Marker({#}
{# position: polygonCoords[0],#}
{# map: map,#}
{# });#}
{# map.setZoom(15);#}
{##}
{# } else {#}
{# const polygon = new google.maps.Polygon({#}
{# paths: polygonCoords,#}
{# strokeColor: "#5990bd",#}
{# strokeOpacity: 0.8,#}
{# strokeWeight: 2,#}
{# fillColor: "#5990bd",#}
{# fillOpacity: 0.35,#}
{# });#}
{##}
{# polygon.setMap(map);#}
{##}
{# // Create a new bounds object#}
{# const bounds = new google.maps.LatLngBounds();#}
{##}
{# // Extend the bounds to include each point of the polygon#}
{# polygonCoords.forEach(function(coord) {#}
{# bounds.extend(coord);#}
{# });#}
{##}
{# // Fit the map to the new bounds#}
{# map.fitBounds(bounds);#}
{# {% endfor %}#}
{##}
{# // Listen for the 'idle' event on the map and then adjust the zoom#}
{#google.maps.event.addListenerOnce(map, 'idle', function() {#}
{# map.setZoom(map.getZoom() - 1); // Zoom out by one level after the map has fit the bounds#}
{#});#}
{# }#}

</script>
</head>
<body>
Expand Down

0 comments on commit aac61c2

Please sign in to comment.