Created
November 12, 2017 18:09
-
-
Save ericjames/d7d40fdd50c624aa433d495e63028e38 to your computer and use it in GitHub Desktop.
Fusion Tables set new layer and set styles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Will grab a fusion table layer for each | |
function getFusionTableLayer(mapLayer, fusiontableID) { | |
var fusionLayer = new google.maps.FusionTablesLayer({ | |
query: { | |
select: '*', | |
from: fusiontableID | |
} | |
}); | |
fusionLayer.setOptions({ | |
suppressInfoWindows: true, | |
styles: [{ | |
where: '*', | |
polygonOptions: { | |
fillColor: '#ffffff', | |
fillOpacity: 0.2, | |
strokeColor: '#222222', | |
strokeWeight: 1, | |
strokeOpacity: 0.5, | |
} | |
}] | |
}); | |
}); | |
function setFusionLayerColors(candidate, opacity) { | |
var styles = []; | |
var strokeColor = '#555555'; | |
for (var i = 0; i < scale.length; i++) { | |
styles.push({ | |
where: '\'' + candidate + '\' >= ' + scale[i], | |
polygonOptions: { | |
fillColor: scaleColors[i], | |
fillOpacity: opacity, | |
strokeColor: strokeColor, | |
strokeWeight: 1, | |
strokeOpacity: 1, | |
} | |
}); | |
} | |
currentLayer.setOptions({ | |
'styles': styles | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment