0

I have been querying locations from a Google fusion table and mapping the points to a Google maps layer using the following code:

        function mapPoints() {
            searchStr = 'ST_INTERSECTS(Location, RECTANGLE(' + 'LATLNG' + map.getBounds().getSouthWest() + ',' + 'LATLNG' + map.getBounds().getNorthEast() + '))';
            layer.setOptions({
                query: {
                    select: 'Location',
                    from: tableid,
                    where: searchStr
                }
            });
        }

In addition to mapping the locations I'd like to store the data returned from the query in some sort of table for further manipulation/reference. Can anyone advise me on how to do this.

Ben Pearce
  • 6,884
  • 18
  • 70
  • 127

2 Answers2

0

If you are looking to do this on the server side, than you could definitely do this using the SQL API, which supports the same query syntax as the map layer.

https://developers.google.com/fusiontables/docs/developers_guide#WritingApps

There is not currently any published way to access the individual locations in a FusionTables Layer however, so that would prevent you from holding a local copy of the location data on the client.

javram
  • 2,635
  • 1
  • 13
  • 18
  • I don't see a way to bridge the server side queried data and the map layer. My goal is to avoid making two queries. – Ben Pearce Apr 26 '12 at 06:55
0

But there is an "undocumented" JSONP option for querying Fusion Tables. I gave some example code in this answer. It's the same API and returns the actual FT features as well as the Location.

Community
  • 1
  • 1
Eric Bridger
  • 3,751
  • 1
  • 19
  • 34
  • It took a little tweaking to implement but the link on the site you linked to did exactly what I wanted. Thanks a bunch! http://www.reddmetrics.com/2011/08/10/fusion-tables-javascript-query-maps.html – Ben Pearce Apr 29 '12 at 23:51