Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

A Use-Case for Google Fusion Tables

DZone's Guide to

A Use-Case for Google Fusion Tables

Google has a new (experimental) way to display tabular data called Google Fusion Tables. It's very simple to use- read on for a quick look at how to use it!

· Integration Zone
Free Resource

Share, secure, distribute, control, and monetize your APIs with the platform built with performance, time-to-value, and growth in mind. Free 90-day trial of 3Scale by Red Hat

I’ve been traveling somewhat during the last few years, and I wanted to check on a map which countries I already visited. There’s one requirement: I wanted the whole area of countries I’ve visited to be highlighted. There are a couple of solutions for that:

The Elastic Stack

Data can be stored in ElasticSearch, and there’s one world map visualization available for the Kibana dashboard. This works, but:

  1. The visualization handles geolocation, but no highlighting an entire country
  2. It requires some setup, and I’m a developer- read that I’m lazy.
Dedicated App

To be honest, I didn’t search, but I assumed "there is an app for that." But, by using a dedicated app, you’re not the owner of your own data anymore, and that doesn’t suit me.

Google Maps

Google Maps allows you to add layers and dedicated data. This solution would be a great fit, if it were possible to easily highlight countries. And still, there’s still a lot of JavaScript to write.

Now comes Google Fusion Tables (Fusion Tables is an experimental service offered by Google).

Creating the Table

While it’s possible to input the data directly into Fusion Tables, it’s easier to do that in a simple Google Spreadsheet. The following is sample data:

Date Country Place Type Event

2017/06

Denmark

Copenhagen

Conference

JDK.io

2017/06

Sweden

Malmö

Conference

JKD.io

2017/05

Ukraine

Kiev

Conference

JEEConf

2017/05

Greece

Athens

Conference

Voxxed Days


Such a spreadsheet can easily be imported into Fusion Tables.

  1. Connect to Fusion Tables on Google Drive. From Drive’s homepage, go on My Drive ▸ More ▸ Connect More Apps. Search for "fusion." Click on Connect. Connect Google Fusion Table on Drive
  2. Create a new Fusion Tables document. From the Drive’s homepage, click on New ▸ More ▸ Google Fusion Tables. Then select Google Spreadsheet. Import Google Spreadsheet into Fusion Tables
  3. Select the desired spreadsheet and click Select. Import new table
  4. Name the table accordingly and click Finish. It yields something akin to the following: Import new table

Out-of-the-box, there’s a Map of Country tab that displays each data line on a world map. Unfortunately, it’s a simple dot at the center of the country. It doesn’t fulfill the initial requirement of highlighting the entire country area.

Default world map view

Changing the Location field to "Place" instead of "Country" will place dots at the correct location instead of the country center, but still no highlighting.

Merging Multiple Fusion Tables

Fusion Tables support geometries that can be defined using the Keyhole Markup Language format. That can fulfill the highlighting requirement. Yet, that would mean defining the geometry of each country visited manually; it requires effort I’m not prepared to make. Fortunately, it’s possible to "join" multiple tables - it’s called merging. Merging creates a new table, with both tables associated with it. Even better, if any of the initial table data changes, it’s reflected in the merged table.

Good news: there’s an existing publicly accessible table defining all country geographies. Let’s merge the existing table with it in File ▸ Merge. In the Or paste a web address here field, paste the URL from the world countries above. Click Next. The opening pop-up requires you to define the "join" columns of the tables.

Default world map view

Click Next. In the opening pop-up, tick the checkboxes of columns that will be part of the merged table. Click Merge. Wait for the merge to happen. Click View table.

Now, on the world map tab, changing the Location field to "geometry" yields the expected result.

Highlighted world map view

At this point, the requirement is fulfilled. Further refinements would be to access the data via its REST API.

Conclusion

Fusion Tables is a no-fluff, just-stuff cloud service that allows us to easily display data in various ways. With its ability to join with other tables, it’s easy to reuse existing tabular data.

Explore the core elements of owning an API strategy and best practices for effective API programs. Download the API Owner's Manual, brought to you by 3Scale by Red Hat

Topics:
google ,maps ,tables ,integration ,data visualization

Published at DZone with permission of Nicolas Frankel, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}