Search code examples
javascriptgoogle-mapsgoogle-fusion-tables

enabling MapTips on a FusionTableLayer


I'm able to retrieve the nearest objects and to work with 2 layers (objects and traffic) but I don't succeed in enabling the Map Tips. I'm simply getting an error this method (enableMapTips) is not supported and to me the issue seems to be related to the FusionTablesLayer constructor.
Please find snippet of code below:

         var fusionTablesLayer = new google.maps.FusionTablesLayer({
                 query: {
                      select: 'Locatie',
                      from: '1Tr5NFqERkQl1ifC19eVMj12S-Za8NJra8TCN5gs',
                      orderBy: 'ST_DISTANCE(Locatie, LATLNG(51.219987, 4.396237))',
                      limit: 15
                 }
                 });


          fusionTablesLayer.enableMapTips({
                    select: "'Restaurant'", // list of columns to query, typially need only one column.
                    from: tableId, // fusion table name
                    geometryColumn: 'Locatie', // geometry column name
                    suppressMapTips: false, // optional, whether to show map tips. default false
                    delay: 100, // milliseconds mouse pause before send a server query. default 300.
                    tolerance: 8 // tolerance in pixel around mouse. default is 6.
                  });

          fusionTablesLayer.setMap(myMap);

          var trafficLayer = new google.maps.TrafficLayer();
          trafficLayer.setMap(myMap);

And when I change the constructor (although I don't see the point of adding the map key-value pair) I can see one MapTip is being generated but I'm still getting an error:

Please find snippet of code below:

         var fusionTablesLayer = new google.maps.FusionTablesLayer({
                 query: {
                      select: 'Locatie',
                      from: '1Tr5NFqERkQl1ifC19eVMj12S-Za8NJra8TCN5gs',
                      orderBy: 'ST_DISTANCE(Locatie, LATLNG(51.219987, 4.396237))',
                      limit: 15
                 }, 
                                    map: myMap
                 });

I'm trying to post this topic on Google Fusion groups as well. Any help much appreciated.


Solution

  • To use FusionTips you need to:

    • include the third party library

      <script src="/path/to/fusiontips_compiled.js" type="text/javascript"></script>
      
    • Enable downloads (so the library can access the data)