样式未应用于Google Fusion表层

Style not being applied to Google Fusion Table Layer

本文关键字:Fusion 表层 Google 应用于 样式      更新时间:2023-09-26

我有一个方法可以查询状态边界的一个公共Fusion表。我想做的是用不同的颜色突出显示威斯康星州,并改变伊利诺伊州的填充级别。这是代码:

 layer = new google.maps.FusionTablesLayer(531237, {
         query: "select geometry from 531237 WHERE STATE_ABBR in (" + states + ") " ,
         styles: [                       
                    { where: "STATE_ABBR = 'WI'", polygonOptions: { fillColor: "#0000FF" } },
                    { where: "STATE_ABBR = 'IL'", polygonOptions: { fillOpacity: 1.0} }
                 ]
        });
layer.setMap(map);

当查询返回时,威斯康星州和伊利诺伊州的高亮显示颜色与其他所有州相同。我的风格有语法错误吗?

您想要更像这样的东西:

layer = new google.maps.FusionTablesLayer({
   query: {
     select: 'geometry',
     from: '531237',
     where: "STATE_ABBR in (" + states + ") "
   },
   styles: [                       
     { where: "STATE_ABBR = 'WI'", polygonOptions: { fillColor: "#0000FF" } },
     { where: "STATE_ABBR = 'IL'", polygonOptions: { fillOpacity: 1.0} }
   ]
});