adding border around downtown brewery map
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 May 2018 13:02:26 +0000 (09:02 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 2 May 2018 13:02:26 +0000 (09:02 -0400)
sections/brewery-map.php

index 54ff27f..a24fd30 100644 (file)
@@ -15,7 +15,7 @@
     function initMap() {
         // Styles a map in night mode.
         var url = '<?php echo $url ?>';
-        console.log(url);
+
         map = new google.maps.Map(document.getElementById('brewery-map'), {
             center: {lat: 42.2903325, lng: -85.5853277 },
             zoom: 14,
                 }
             ]
         });
+        var downtown = [
+          {lat: 42.295482, lng: -85.578543},
+          {lat: 42.294493, lng: -85.590343},
+          {lat: 42.288731, lng: -85.597809},
+          {lat: 42.288811, lng: -85.579227},
+          {lat: 42.295482, lng: -85.578543},
+        ];
         var poly = new google.maps.Polyline({
+            path:downtown,
             strokeColor: '#91311D',
             strokeOpacity: 2.0,
             strokeWeight:2,
             map:map
         });
+        poly.setMap(map);
         var distancePath = new google.maps.Polyline();
         function drawLine(point1, point2) {
             
                 map: map,
                 html: `<img src="${url}${feature.icon}"/>`
             });
+
             // Add a click listener for this marker
             marker.addListener('click', function(event) {
-                
-            
                 compare.push(new google.maps.LatLng(event.latLng.lat(), event.latLng.lng()));
                 if(compare.length >= 2){
                     // console.log(`${previous}, ${current}`)
                     distance = `<div class="distance-marker"><span class="marker-label">Distance:</span> ${Math.round(convertMetersToFeet(google.maps.geometry.spherical.computeDistanceBetween(last(compare), compare[compare.length - 2] ) ) * 10) / 10} Miles</div>`;
-                    // console.log(distance)
+    
                     drawLine(last(compare),compare[compare.length - 2])
                 } else {
                     distance = '';
                 }
-                
-                // path.push(feature.position);
-   
                 infowindow.setOptions({
                         content: info + `${distance}`
                 });
                 infowindow.open(map,this);
-
             });
-            
         });
-        
     }
 //     </script>
 <script src="https://maps.googleapis.com/maps/api/js?place=Kalamazoo,+MI&amp;key=AIzaSyCBFqeBtlAGoVcpFBa5Ldrb1QajYnbCrac&amp;callback=initMap&amp;libraries=geometry" async="" defer=""></script>
\ No newline at end of file