title: Google Maps: clickable polyline icon
body: <p>I have two markers with a polyline connecting the two. 
  I have click events on the markers and the polyline, but i was trying to make the polyline easier to click without placing a new marker or increasing it's strokeWeight.
  So I created a circular icon and placed on the polyline, but I can't make it clickable. Is it possible? </p>
  
  <p>Saw this thread but doesn't give any specifics on how the icon is clickable. I searched it's code source but he adds a KML layer. I didn't want to do that.
  <a href="https://stackoverflow.com/questions/14823927/google-maps-attaching-events-on-polyline-icons">Google Maps: Attaching events on polyline icons</a></p>
  
  <p>Searched the google maps overlay API but didn't find any interface to listen to click events.
  <a href="https://developers.google.com/maps/documentation/javascript/overlays#Polylines" rel="nofollow noreferrer">https://developers.google.com/maps/documentation/javascript/overlays#Polylines</a></p>
  
  <p>I also tried to attach an event listener but didn't work. I suspect it can't be done without adding an actual marker or an object but if someone else had a similar problem i would appreciate any tips :)</p>
  
  <p>Thanks in advance!</p>
  
  <p>My code:</p>
  
  <pre><code>var pathSymbol = {
      path: google.maps.SymbolPath.CIRCLE,
      scale: 8,
      strokeColor: '#228B22'
  };
  
  var conPath = new google.maps.Polyline({
      path: conCoord,
          strokeColor: "#228B22",
          strokeOpacity: 0.7,
          icons: [{
              icon: pathSymbol,
              offset: '50%'
          }],
          strokeWeight: 2
  });
  
  conPath.setMap(map);
  
  
  google.maps.event.addListener(conPath, 'click', (function(l,conCoord) {
      return function() {
              infowindowPath.setContent("&lt;b&gt;Ligação "+connections[l].id);
          infowindowPath.setPosition(new google.maps.LatLngBounds(conCoord[1], conCoord[0]).getCenter());
              infowindowPath.open(map);
          }
  })(l,conCoord));
  </code></pre>