如何使用融合 table 在 Google 地图上突出显示多个国家/地区

How to highlight multiple countries on Google Maps using fusion table

我试图在 Google 地图上突出显示多个国家,但我对查询有点困惑。它适用于单个国家,例如,如果我突出显示墨西哥它有效,但是当尝试突出显示墨西哥 印度时它不起作用。

jsFiddle

我试过下面的代码,但它不起作用

layer = new google.maps.FusionTablesLayer({
  query: {select: "kml_4326", 
          from: tableid,
          where: "name_0 = 'Mexico' and name_0 = 'India'"},
  styles: [{
  polygonOptions: {
    strokeWeight: "0",
    //strokeColor: "#FF0000",
    strokeOpacity: "0.4",
    fillOpacity: "2",
    fillColor: "#FF0000"

  }
}]});  

该代码适用于单个国家/地区。

layer = new google.maps.FusionTablesLayer({
  query: {select: "kml_4326", 
          from: tableid,
          where: "name_0 = 'Mexico'"},
  styles: [{
  polygonOptions: {
    strokeWeight: "0",
    //strokeColor: "#FF0000",
    strokeOpacity: "0.4",
    fillOpacity: "2",
    fillColor: "#FF0000"

  }
}]});

我还尝试将下面的代码作为 Google 来自 Google Developers 的文档参考,但它突出显示了整个地图。

layer = new google.maps.FusionTablesLayer({
    query: {
      select: 'kml_4326',
      from: tableid
    },
    styles: [{
      polygonOptions: {
        //fillColor: '#00FF00',
       // fillOpacity: 0.3
      }
    }, {
      where: 'name_0 == India',
      polygonOptions: {
        fillColor: '#000'
      }
    }, {
      where: 'name_0 == Mexico',
      polygonOptions: {
        fillOpacity: 1.0,
        fillColor: '#00FF00'
      }
    }]
  });

  layer.setMap(map);

尝试将您的 select 语句更改为:

query: {select: "kml_4326", 
          from: tableid,
          where: "name_0 IN ('Mexico','India')"
       },