Search code examples
mapsgoogle-fusion-tables

Fusion Tables styling


I'm trying to apply multiple styles to a Google Fusion Table Layer.

This does not colors all polygons that are in an array to the different color:

styles: [{
where: 'Cadmio = 3391',
polygonOptions: {
fillColor: '#e60000',
fillOpacity: 1
}
}, 
{
where: 'Cadmio = 1074',
polygonOptions: {
fillColor: '#ffaa00',
fillOpacity: 1
}
},
{
where: 'Cadmio = 370',
polygonOptions: {
fillColor: '#38a800',
fillOpacity: 1
}
},{
where: 'Cadmio = 156',
polygonOptions: {
fillColor: '#74c200',
fillOpacity: 1
}
},{
where: 'Cadmio = 90',
polygonOptions: {
fillColor: '#98e600',
fillOpacity: 1
}
},{
where: 'Cadmio = 71',
polygonOptions: {
fillColor: '#ffff00',
fillOpacity: 1
}
}]
});

The last one Whereclause is not working, It seems that de javascript code just accept 5 Whereclauses? What can I do? also I stylised it with Fusion tables map-view and I would like to set the opacity of the polygons with Javascript.


Solution

  • There is a limit of 5 styles per map. https://developers.google.com/maps/documentation/javascript/layers#fusion_table_styles

    Styles can only be applied to a single Fusion Tables layer per map. You may apply up to five styles to that layer.

    You can, however set styling using the Fusion Tables API and expand on that limitation.