Skip to content

Instantly share code, notes, and snippets.

@ericjames
Created November 12, 2017 18:09
Show Gist options
  • Save ericjames/d7d40fdd50c624aa433d495e63028e38 to your computer and use it in GitHub Desktop.
Save ericjames/d7d40fdd50c624aa433d495e63028e38 to your computer and use it in GitHub Desktop.
Fusion Tables set new layer and set styles
// 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