Thursday, May 27, 2010

Map your data with the Maps API and Fusion Tables

If you have ever tried to plot a very large number of overlays on an API map you have probably reached a point at which the performance of your application begins to suffer. With one hundred or so markers, most browsers cope just fine, and clustering solutions like Fluster can help support more. But if you have thousands of overlays that you wish to show, rendering them individually can be problematic.

The Maps API v3 now offers two solutions to this problem. If you have a large volume of geospatial data that can be served as KML, the KmlLayer class can render up to 50,000 features as an overlay that does not impact performance on any browser. To support data sets that are structured as tables, such as a database or spreadsheet, we have also now added the FusionTablesLayer class for rendering data stored in Google Fusion Tables.

Google Fusion Tables is a fascinating new experimental Google Research project offering storage, search, and management of large structured data sets in the cloud. Up to 100MB of data can be stored per table, and each row in a table can have an associated location, line, or polygon feature. Using the FusionTablesLayer class you can render features on an API map as a clickable overlay. When a feature is clicked, the application can access a copy of the complete row of data associated with the feature.

Fusion Tables also supports an SQL like query language, which you can use to filter the features shown on a map. The below map visualises mountain biking trails uploaded to Fusion Tables by mtbguru.com. The slider allows you to filter trails by their length, and the trails shown on the map are updated accordingly. If you click on a trail a custom dialog is shown which indicates the elevation profile for the trail concerned.



The FusionTablesLayer also supports rendering data sets as a heatmap. The below map of beaches in Brazil illustrates the benefit of this. When rendered as point features it is difficult to tell the relative density of the beaches without zooming in further. However once you switch to displaying the data as a heatmap the high density of beaches west of Rio de Janeiro becomes immediately clear.



The combination of Fusion Tables with the Maps API makes it easy to host large sets of data in the cloud, and visualise them in your Maps API application. It is quick and simple to get up and running with Fusion Tables, and the addition of the FusionTableLayer class to Maps API v3 enables Maps applications to be tightly coupled with data hosted in Fusion Tables. Give it a try, and let us know what you think of this experiment in the Groups!