Search code examples
google-mapsgoogle-maps-api-3google-fusion-tables

Selecting a polygon in a FusionTablesLayer from Javascript


I have a map with FusionTablesLayer for my fusion table. The resulting map is a set of coloured polygons. If the user clicks on a polygon, the data associated with this polygon is displayed in the form of a info window. Can I select a particular polygon from javascript instead of via a mouse click? For example, if I have a chart with the same data, it would be nice to update the map for the current chart selection.


Solution

  • You haven't posted any code so this is just a guess. My approach would be:

    1. Create a unique key for each polygon in your FT
    2. Associate those keys with your charts or links
    3. Create a special FT layer to handle the highlighting with a unique color
    4. For a chart or link click set the query options for your highlight layer using the unique key to retrieve the correct polygon overlaid on the existing polygon with your unique color.