Skip to content

Instantly share code, notes, and snippets.

@jlivni
Created September 17, 2013 23:31

Revisions

  1. jlivni created this gist Sep 17, 2013.
    23 changes: 23 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    function highlightCorrelations(currentMarker){
    // first make all the airports small
    $.each(airports, function(id, marker) {
    marker.setIcon(getIcon(2, 'black'));
    });
    // for each airport correlated to the selected airport, set it's icon to red
    $.each(currentMarker.correlations, function(i, correlation) {
    var marker = airports[correlation[0]];
    marker.setIcon(getIcon(correlation[1], 'red')); //getIcon returns a circle symbol
    });
    }


    function getIcon(scale, color) {
    return {
    path: google.maps.SymbolPath.CIRCLE,
    fillColor: color || 'black',
    fillOpacity: .6,
    strokeColor: 'white',
    strokeWeight: .5,
    scale: scale * Math.pow(1.4, map.getZoom()) // Bigger circles as you zoom in
    };
    }