2013-03-28 68 views
0

我有一個融合表與5個人口(列),對於每個這些我想顯示不同顏色的人口最高濃度的多邊形。造型融合表層多邊形

在樣式融合表圖層的示例中,定義了「多邊形選項」,但我不希望多邊形具有任何樣式,除非其中一個樣本集中,並且因爲這需要1樣式遠離極限5.

我不確定要改變什麼,或者我錯過了讓這些樣式正確顯示的東西。

我的地圖:http://seflculturemap.com/miami-test.html

回答

0

你的第一個問題是列名,當它們包含空格,則必須在查詢中單引號包起來。

另一個問題(您需要應用6個樣式,但有5個限制)。您也可以直接爲地圖創建樣式,因此您可以創建一個虛擬樣式,將所有多邊形的不透明度設置爲0.

要應用此樣式,請使用樣式的ID並將其傳遞給options-參數到圖層。我已經創造了這樣一個虛擬式的地圖,它確實有ID 4

層創造現在應該是這樣的: VAR層1 =新google.maps.FusionTablesLayer({

query: { 
    select: 'geometry', 
    from: '1PM3_L795Eus1HXCylF6UM0tLqXarnkNZeB_LmM8' 

    }, 
    options: { 
     styleId: 4 
     }, 
    styles: [ 
    { 
     where: "'Puerto Rican Population' > 500", 
    polygonOptions: { 
    fillColor: "#46A2D1", //blue 
    fillOpacity: 0.7} 
    }, 
    { 
     where: "'Cuban Population' > 500", 
    polygonOptions: { 
    fillColor: "#F29400", //orange 
    fillOpacity: 0.7 } 
    }, 
    { 
     where: "'Bahaman Population' > 100", 
    polygonOptions: { 
    fillColor: "#BAC200", //yellow 
    fillOpacity: 0.7} 
    }, 
    { 
     where: "'Dominican Population' >200", 
    polygonOptions: { 
    fillColor: "#E068A0", //pink 
    fillOpacity: 0.7 } 
    }, 
    { 
     where: "'Haitian Population' > 500", 
    polygonOptions: { 
    fillColor: "#66A919", //green 
    fillOpactity: 0.7} 
    } 
    ] 
}); 

測試:http://jsfiddle.net/doktormolle/8mZuB/


相關的評論:

您正在使用錯誤的列名。

對於http://www.seflculturemap.com/maps/central-american-populations.html

'Nicaraguan' -> 'Nicaraguan Population' 

對於http://www.seflculturemap.com/maps/south-american-populations.html

'Venezuelan Population' ->'Venzuelan Population 
'Peruvian'    ->'Peruvian Population' 
'Argentinian Population' ->'Argentinean Population' 
+0

感謝你的幫助,我無法相信我忘了報價。 ID 4從哪裏來?它是融合表中的默認值? 我還在谷歌開發人員中使用另一個教程添加了一個圖例,但與他們的示例不同,圖例框被推到了地圖的底部,我再次認爲這是css樣式中的衝突(我將它們放置或也許他們是凌駕於對方?) 這是地圖現在的位置[link](http://seflculturemap.com/caribbean-populations.html) – user1947427 2013-03-30 17:22:31

+0

我創建了一個新的地圖視圖(地圖2),並且在爲多邊形應用樣式之後,我去**發佈 - >獲取html和javascript **以查看樣式具有哪個ID。 – 2013-03-30 18:19:35

+0

我用這個相同的html作爲模板來顯示2個其他地圖,甚至在雙重檢查地圖ID是否正確以及列名後,我得到這兩個「數據仍然加載」框。 http://www.seflculturemap.com/maps/central-american-populations.html http://www.seflculturemap.com/maps/south-american-populations.html 我不知道是什麼可能是錯誤的:(@dr。molle – user1947427 2013-04-04 02:43:52