我想在Google地图上突出显示多个国家/地区,但我对此查询有点困惑。它可以在一个国家/地区运行,例如,如果我强调墨西哥它有效,但是当尝试突出墨西哥和印度时它不起作用。
我已经尝试过以下代码,但它无效
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 Developers的Google文档引用,但它会突出显示整个地图。
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);
答案 0 :(得分:1)
尝试将select语句更改为:
query: {select: "kml_4326",
from: tableid,
where: "name_0 IN ('Mexico','India')"
},