문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top