Fusion Table和Google Maps API:只有第一类用于渲染功能 [英] Fusion Table and Google Maps API: Only first classes are used for rendering features
问题描述
我使用查询功能从谷歌地图API的Google Fusion Table中过滤功能。它适用于这个代码:
var column = getColumn();
layer = new google.maps.FusionTablesLayer({
suppressInfoWindows:true,
query:{
select:'geometry',
from:tableno
},
款式:[{
polygonOptions:{
fillOpacity:0.8,
strokeColor:'#000000',
strokeOpacity:0.2,
strokeWeight:2
}
},{
其中:''$ fool'< ='5.24'。replace('$ fool',column),
polygonOptions:{
fillColor:'#FEE5D9'
}
},{
其中:''$ fool'>'5.24'。replace('$ fool',
polygonOptions:{
fillColor:'#FCAE91'
}
},{
其中:''$ fool'> 5.83.replace( '$ fool',栏),
polygonOptions:{
fillColor:'#FB6A4A'
}
},{
其中:''$ fool'> 6.49.replace('$ fool',column),
polygonOptions:{
fillColor:'#DE2D26'
}
},{
其中:'' $ fool'> ('$ fool',column),
polygonOptions:{
fillColor:'#A50F15'
}
}]
});
问题是,我无法添加其他类,如果我添加类似于
{
其中:''$ fool'='0'。replace('$ fool',column),
polygonOptions :{
fillColor:'#ffffff'
}
},
<只有前3-4班才会出现,所有以下功能将在最后(第3 /第4)课上着色。
当我想要时,这会变得更严重突出显示所选功能,我在其中创建另一个查询
var NumVal = e.row ['name']。value;
为额外的课程
{
其中:''name'=+ NumVal,
polygonOptions:{
strokeColor:'#88d32f',
strokeOpacity:1,
strokeWeight:4
}
},
突然只有这个和下面的类被使用。所有功能仅在以下课程中着色。
任何人都可以帮忙吗?为什么在添加其他类时突然忽略查询/类?
根据文档,您只能将5种样式规则应用于FusionTablesLayer:
您可以使用Maps API将最多五个Fusion Tables图层添加到地图中,其中一个图层样式最多可以添加五个
样式规则。
I use queries for filtering features from a Google Fusion Table with the Google Maps API. It works very well with this code:
var column = getColumn();
layer = new google.maps.FusionTablesLayer({
suppressInfoWindows: true,
query: {
select: 'geometry',
from: tableno
},
styles: [{
polygonOptions: {
fillOpacity: 0.8,
strokeColor: '#000000',
strokeOpacity: 0.2,
strokeWeight: 2
}
}, {
where: "'$fool' <= '5.24'".replace('$fool', column),
polygonOptions: {
fillColor: '#FEE5D9'
}
}, {
where: "'$fool' > '5.24'".replace('$fool', column),
polygonOptions: {
fillColor: '#FCAE91'
}
}, {
where: "'$fool' > 5.83".replace('$fool', column),
polygonOptions: {
fillColor: '#FB6A4A'
}
}, {
where: "'$fool' > 6.49".replace('$fool', column),
polygonOptions: {
fillColor: '#DE2D26'
}
}, {
where: "'$fool' > 7.37".replace('$fool', column),
polygonOptions: {
fillColor: '#A50F15'
}
}]
});
The problem is, that I cannot add another class. If I add something like
{
where: "'$fool' = '0'".replace('$fool', column),
polygonOptions: {
fillColor: '#ffffff'
}
},
only the first 3-4 classes are rendered. All following features will be coloured in the last (3rd/4th) class.
This becomes more serious when I want to highlight the selected feature, where I create another query
var NumVal = e.row['name'].value;
for an additional class
{
where: "'name' = " + NumVal,
polygonOptions: {
strokeColor: '#88d32f',
strokeOpacity: 1,
strokeWeight: 4
}
},
Suddenly only this and the following class are used. All features are coloured in the following class only.
Can anybody help? Why are suddenly queries/classes ignored when additional classes are added?
According to the documentation under "Limits", you can only apply 5 styling rules to a FusionTablesLayer:
You can use the Maps API to add up to five Fusion Tables layers to a map, one of which can be styled with up to five styling rules.
这篇关于Fusion Table和Google Maps API:只有第一类用于渲染功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!