0
我有google fusion table
文件的列name
和geometry
,那麼我想改變地圖的樣式與不同顏色的每個不同的名稱在融合表,並顯示在我的地圖應用程序(我使用google map api v3
)這是我的腳本:造型谷歌Fusion Tables的使用JavaScript
layer = new google.maps.FusionTablesLayer({
query : {
select : 'geometry',
from : 'xxx'
},
styles : [{
where: 'name IN (Agro Industri)',
polygonOptions : {
fillColor : '#66cc66'
}
},{
where: 'name IN (Bandara)',
polygonOptions : {
fillColor : '#007fff'
}
},{
where: 'name IN (Fasilitas Pendidikan)',
polygonOptions : {
fillColor : '#cc0000'
}
},{
where: 'name IN (Gardu Induk)',
polygonOptions : {
fillColor : '#ff0000'
}
},{
where: 'name IN (Horti & Kebun)',
polygonOptions : {
fillColor : '#66cc66'
}
},{
where: 'name IN (Hutan Lindung)',
polygonOptions : {
fillColor : '#007f00'
}
},{
where: 'name IN (Hutan Rakyat)',
polygonOptions : {
fillColor : '#007f1f'
}
},{
where: 'name IN (Industri)',
polygonOptions : {
fillColor : '#c0c0c0'
}
},{
where: 'name IN (Kawasan Pariwisata)',
polygonOptions : {
fillColor : '#ffbf7f'
}
},{
where: 'name IN (Kawasan Pemerintahan)',
polygonOptions : {
fillColor : '#ff0000'
}
},{
where: 'name IN (Perdagangan & Jasa)',
polygonOptions : {
fillColor : '#ff00ff'
}
},{
where: 'name IN (Kawasan Permukiman)',
polygonOptions : {
fillColor : '#ffff00'
}
},{
where: 'name IN (KKP)',
polygonOptions : {
fillColor : '#bf00ff'
}
},{
where: 'name IN (Kompleks Militer)',
polygonOptions : {
fillColor : '#00994c'
}
},{
where: 'name IN (KPS)',
polygonOptions : {
fillColor : '#7dd000'
}
},{
where: 'name IN (Minapolitan)',
polygonOptions : {
fillColor : '#007fff'
}
},{
where: 'name IN (Pertanian Tanaman Pangan)',
polygonOptions : {
fillColor : '#a0ffa0'
}
},{
where: 'name IN (RSUD)',
polygonOptions : {
fillColor : '#ff0000'
}
},{
where: 'name IN (RTH)',
polygonOptions : {
fillColor : '#00ff00'
}
},{
where: 'name IN (Sentral Parkir)',
polygonOptions : {
fillColor : '#007fff'
}
},{
where: 'name IN (Tahura)',
polygonOptions : {
fillColor : '#bc50f0'
}
},{
where: 'name IN (Terminal Barang)',
polygonOptions : {
fillColor : '#007fff'
}
},{
where: 'name IN (Terminal Penumpang)',
polygonOptions : {
fillColor : '#007fff'
}
},{
where: 'name IN (TWA Sangeh)',
polygonOptions : {
fillColor : '#007f3e'
}
}]
});
layer.setMap(map);
地圖顏色有改變,但遺憾的是所有的顏色相同,顏色不希望按照名稱變更。
有人可以幫助我解決問題嗎?我該怎麼辦才能解決這個問題?
謝謝您的解決方案 – Adi