-
Notifications
You must be signed in to change notification settings - Fork 0
fusiontables
Google Fusion Tables (shortened as Fusion Tables) is a web app developed by Google in 2009. It's an online data sheet tool for data management, visualization and sharing, and interaction with other google applications. Fusion Tables has two interfaces:
- The Graphic Interface for Web Users
- The API for Programmers
You can have a basic ideas about Fusion Tables Here: Help Page for Fusion Tables.
Basically, Fusion Tables allows you to:
- Find public data
- Import your own data(CSV, KML, ODS, XLS, or Google Spreadsheets)
- Manage your data
- Visualize your data
- Merge two tables
- Share your data
To Find Public Data, go to Fusion Tables Public Data. Example: Starbucks Locations
-
Log in your google account.
-
Open your Google Drive.
-
In the sidebar on the left, click on "New->More->Connect More Apps"
-
Search for Fusion Tables, click on "Connect"
-
Now, again in the left sidebar, click on "New->More->Google Fusion Tables(A green icon with a white zigzagging line through it)"
-
Choose one of the three options to create a new table.
- Table ID(Unique ID number of a table)
-
In the menu, click on "file->about this table"
-
The last entry is the table ID.
- Access Control
-
Click on "file->share"
-
By default, a table is private at first-only the creator can access this table. To invite more editors, Type in the names or email addresses to be invited.
-
To change the access settings, click on "change..." below "Who can access".
- Table Management
-
Edit Columns and Rows
-
Add a new visualization style
-
Merge two tables or Create a View(A subset of a table)
It takes several steps to create a project, and interact with Fusion Tables in Java.
Every request your application sends to the Fusion Tables API needs to identify your application to Google.
If the request requires authorization (such as a request for an individual's private data), then the application must provide an OAuth 2.0 token with the request.
If the request doesn't require authorization (such as a request for public data), then the application must provide either the API key or an OAuth 2.0 token, or both—whatever option is most convenient for you.
So, OAuth 2.0 token works in both cases. Let's use the token!
To get an OAuth 2.0 token(https://developers.google.com/fusiontables/docs/v2/using#auth):
-
Login your Google Account(Better NOT be your A&M account).
-
Go to the Google Developers Console.
-
In the top bar, Click on "Select a project". Then, in the dropdown menu, click on "Create a project...". Type in the project name, and create a project.
-
Now, on the left top corner, click on the 'menu' icon(3 white bars to the left of 'Google Developers Console'). In the dropdown menu, click on 'API manager'.
-
In the left sidebar, choose "Overview". Then, choose "Google APIs", search for "Fusion Tables", click on "Enable API".
-
In the left sidebar, choose "Credentials". Then, in the menu on the top, choose the "OAuth consent screen" tag. Type in your email address and the name of the project. Scroll down to the bottom and click on "Save".
-
Now, in the top menu, choose "Credentials". Click on "New Credentials". In the dropdown menu, choose "OAuth Client ID".
-
What to do next depends on the application type:
-
For a Java App: Choose the type "Other", and type in a name for the project. Click on "Create".
-
For an Android App: There is an additional step: Getting your package name and SHA-1 fingerprint.
To get your package name: https://help.tune.com/marketing-console/finding-your-apps-package-name/
To get your SHA-1 fingerprint: http://www.truiton.com/2015/04/obtaining-sha1-fingerprint-android-keystore/
Finally, download the Client ID JSON object(Click on the downward arrow on the right).
-
Download the Fusion Tables API(version 2) Client Library for Java from https://developers.google.com/api-client-library/java/apis/fusiontables/v2. In this zip file, The libs folder contains all the of the globally applicable dependencies you might need across all application types.
-
Create a new project in IntelliJ. There are 3 things to add to your project, as we did in JDBC(https://stackoverflow.com/questions/1051640/correct-way-to-add-external-jars-lib-jar-to-an-intellij-idea-project):
-
Add the libs folder to your project.
-
Add the jar file
google-api-services-fusiontables-v2-rev5-1.21.0.jar(which can be found in the zip file) to your project. -
Add
servlet-apiJAR to your project. Downloading Link: https://drive.google.com/file/d/0B8nAMK2N4ng_bS1ROXNfekpxaFk/view. This is to launch a web page which allows the client to authenticate and allow changes to be made to the client Fusion Table.
-
Add the Client ID JSON object(which is downloaded in the previous step) to the .src folder of your project.
-
You should be good to go now. Try the sample code(which is in my folder,
efc322, in the course repository), or learn the Fusion Tables API and write your own code!
NOTE: If you decide to run the sample code first, you need to modify the name of your client ID JSON object file, and make sure a Fusion Table with a proper name has been created in your Google Drive.
First, it's necessary to know the basic concepts in Fusion Tables: https://developers.google.com/fusiontables/docs/v2/getting_started#background-concepts
Try to read the sample code I've uploaded first.
For the info. about how OAuth 2.0 works: https://developers.google.com/identity/protocols/OAuth2#basicsteps
For more details on the functions and classes associated with Fusion Tables: https://developers.google.com/resources/api-libraries/documentation/fusiontables/v2/java/latest/
The Google Fusion Tables API v2.0 uses the verbs from HTTP protocol to send data requests to Google Server(Regardless of which you use, the URI starts with: "https://www.googleapis.com/fusiontables/v2"):
- Using REST for tables, columns, styles, and templates
Format: https://www.googleapis.com/fusiontables/v2/resourceID?parameters
Check some Examples here: https://developers.google.com/fusiontables/docs/v2/getting_started#REST

- Using SQL for rows
Format: www.googleapis.com/fusiontables/v2/query?sql=query, where query is a valid SQL query.
Check some examples here: https://developers.google.com/fusiontables/docs/v2/getting_started#SQL

Details on Syntax in Fusion Tables:
Basic Operations: https://developers.google.com/fusiontables/docs/v2/getting_started#background-operations
More Details on the Basic Operations: https://developers.google.com/fusiontables/docs/v2/using#WorkingTables
References: https://developers.google.com/fusiontables/docs/v2/reference/