Fusion table api map not showing styles after table update

后端 未结 1 1304
盖世英雄少女心
盖世英雄少女心 2021-01-22 19:06

I\'m relatively new to the Fusion Tables Api and I am trying to create a simple web app using Fusion Tables and Google Maps Api. The application will be used about three times a

相关标签:
1条回答
  • 2021-01-22 19:46

    It's an API-issue, the tiles created to display the layers will also be cached by google.

    What you can do: modify the queries, so that it still fetches the same results, but the String-representation for the query is different. This should speed-up the tile-update(and prevent from client-side caching).

    Taking your code it could be done like this:

    var and=' Location does not contain "'+new Date().getTime()+'"';
    
     layer = new google.maps.FusionTablesLayer({
        query: {
          select: "geometry",
          from: '11CIZUlNjBPiOM1Y4pDUP_Mn9TxkqF0etfpWhi5c',
          where: and
        },
        styles:[
        {
            polygonOptions:{
                    fillColor: '#FF0000',         
                    fillOpacity: 0.05 
                    }
        },
        {
            where: "Location LIKE 'PERDUE' and "+and,
            polygonOptions: {
            //fillColor: '#0000FF'
            fillOpacity:0.2
            } 
        },
        {
            where: "GeoBlock = 'AC1C' and "+and,
            polygonOptions: {
            //fillColor: '#0000FF'
            fillOpacity:0.8
            }
        },
        {
            where: "Location = 'BENGOUGH' and "+and,
            polygonOptions: {
            //fillColor: '#0000FF'
            fillOpacity:0.99
            }  
        }]
      });
    

    Instead of using new Date().getTime() I would suggest to use(when available) e.g. the timestamp of the last modification so that the cached tiles still may be used when no update has been done.

    0 讨论(0)
提交回复
热议问题