Four Ways Developers Can Use Google Fusion Tables

Guest Author
Oct. 27 2010, 12:00AM EDT

This guest post comes from Mano Marks, lead Developer Advocate for Google Maps and Earth. He has been helping individuals and organizations integrate Google Earth, Maps and other Google developer tools into their sites for the last four years. You can follow Mano on Twitter.

A little over a year ago, Google released a new product called Google Fusion Tables. Fusion Tables allows you to upload, merge, share, and visualize large tables of tabular data. Basically, we wanted to answer the question “I have a spreadsheet. I want to share it with people and create a map/bar chart/storyline/other visualization.” Google Spreadsheets, while powerful, couldn’t handle the 100 meg upload we allow for Fusion Tables. And, being Google, we also provided something for developers.

There are four basic ways you can integrate Fusion Tables with your web app.

First, the easy way is to embed a visualization in an iframe. There’s a link on each visualization, and it looks something like this:

<iframe width="500px" height="300px" scrolling="no" src="http://www.google.com/fusiontables/embedviz?viz=MAP&q=select col0%2Ccol1%2Ccol2%2Ccol3%2Ccol4%2Ccol5%2Ccol6%2Ccol7%2Ccol8%2Ccol9%2Ccol10 from 245609 &h=false&lat=12&lng=-144&z=2&t=1&l=col9"></iframe>

That's pretty basic, but hardly ProgrammableWeb worthy.

A second way, more fun for developers, is the Google Fusion Tables API. Using OAuth for authentication, you can programatically interact with Fusion Tables. The API isn’t your usual Google Data API, but actually SQL-like statements issued by HTTP GET and POST. You can do basic CRUD: Create, Read, Update, and Delete operations on tables, rows, columns and views. For instance:

CREATE VIEW 'myView' AS (SELECT geometry, ex_NAME_0 AS country, ex_NAME_1 AS region FROM 265118 WHERE ex_NAME_0 contains ‘United’)

Which creates a view from a table, limiting it to only countries where the word “United” appears, and selecting only three columns.

A couple of fun notes: Creating a VIEW means that it is easy to share subsets of your data in different ways, which means that you can give edit access to only a portion of your data, limiting only certain rows and columns. Also, once you create a TABLE or VIEW, if you make it public and exportable, it is instantly available for use by others, no authentication needed.

The third way is to load it into a Google Maps API app using a FusionTablesLayer. This allows you to load a FusionTable, using a restrictive query if you want, into an existing JavaScript Map API V3 application. It also gives you access to mouse clicks on the layer, so you can capture data like the row that is being displayed and the infowindow HTML and control the output.

Finally, you can get map data as a KML file, either exporting it directly as KML or getting a NetworkLink that updates periodically, so you can capture the most recent data. You could load this into the Maps API (though the FusionTableLayer makes more sense) or you could load it into Google Earth or the Google Earth API.

Google Fusion Tables is still a new product, though we’re ramping up, especially after the transition from googlelabs.com to google.com. The API is still in labs, too. There’s a great community ready to help with questions, and we’re actively seeking your feature requests.

Guest Author

Comments

Comments(4)

ahmed

You can use CaroView for the Google cloud to create and publish your custom online map and your geo data in the Google app engine cloud
CaroView is Opensource

- Configure, author and publish your map from the browser, no programming required
- Render your Geodata from Google fusion Tables and external sources (GeoRSS, KML, ArcGIS Server)
- Select from a large number of plugins to use in your map: twitter, yelp, events, weather and much more

http://www.cartologic.com/cartoview/cloud.aspx
or you can test on
http://cartoviewdemopage.appspot.com/cartocloud/index.html