Sunday, May 7, 2017

How to Create, Share and Publish A Heatmap Using Google Fusion Table

What is Google Fusion Table

Before discussing how to create a heatmap, Firstly let's get to know what Google Fusion Table is. Google fusion table is an application from google and still in experiment stage (beta) that is created for data handling and visualization. The format of data that can be uploaded into google fusion table can be tabular data in an excel format, textual data with txt, csv or tsv and KML format.

There are several benefits of using google fusion table application, among others:
  • One can visualize georeference data quickly.
  • Data visualization can be published online.
  • Uploaded data can be made open, so it can be accessed by others.
  • A table can be joined with other table, so it will be more enriching information.
In this post we will learn how to create a heatmap which overlay on google map like figure 1. Are you interested? Let's get started!

Earthquake heatmap
Figure 1. Earthquake heatmap

Starting Google Fusion Table

To be able to use google fusion table application, you must have a google email account. If you already have a google email account then the google fusion table app can be accessed via the docs page or google drive at http://www.drive.google.com. After signed in, the google drive page could be look like figure 2.
Google Drive Page
Figure 2. Google Drive Page

Earthquake Data Source

In this article we will make an earthquake heatmap. Therefore we need an earthquake dataset. Earthquake dataset can be obtained from USGS website. In this website we can search earthquake data based on time, region and date of earthquake. The data can be downloaded with a KML format, spreadsheet (csv), and QuakeML. For this post  I downloaded the last 30 days earthquake data in csv format.

Upload Dataset Into Google Fusion Table

A new fusion table must be created to upload a new dataset. It can be done by selecting the NEW button from the google drive page and then select Google Fusion Table, as in figure 3. What if the Google Fusion Table does not appear? Do not panic! Click Connect more apps, and search Google Fusion Table then select Connect.

Create a new google fusion table
Figure 3. Create a new google fusion table
If Google Fusion Tables is selected, then will appear a dialog box to create a fusion table like figure 4. 
Import a new dataset into google table fusion
Figure 4. Import a new dataset into google table fusion
There are four methods can be done to create a new google fusion table: 
  • Importing an existing table from a computer.
  • Using google Spreadsheets data in google drive.
  • Create a new empty table.
  • Finding and using public data that has been shared by other user.
Since we already have the earthquake data that has been downloaded before, and the data stored in computer, then we will do the first method. For that, select the Choose File button, then find the downloaded earthquake data. After the data is selected, it will automatically detect and generate  file type and its separator character. If it finish and correct click Next.

The earthquake data to be imported will appear as shown in Figure 5. In this step by default the first row is column names. If in other cases the column names are not on the first row, then it should be adjusted. Thus nothing needs to be changed in this case, and press Next.
Earthquate dataset
Figure 5. Earthquate dataset
The next page will appear to include some information for the table that will be created, such as table name, descriptions and so forth like in Figure 6. Fill in the relevant information, and select Finish button to end the process.
Google Fusion Table Information
Figure 6. Table Information
When the import process is complete. The earthquake point will overlay on google map as shown in Figure 7. We can view the data by line, card and map. To view the data on the map, select Map tab and make sure in map configuration to select a column name which contain location information like latitude or longitude. Later in the map view we can change the icon marker and info window. It can be done in Feature Map option, by selecting Change feature styles or Change info window. Try it by yourself!

Earthquate point view on the map
Figure 7. Earthquate point view on the map

Creating Heatmap

An intensity map or heatmap is a map showing point density on the map. The denser the dots around an area, will have a higher density over the area. To create a heatmap, the Heatmap feature is used. Please note that, the heatmap feature has limitation that only display 1000 rows of records. So if we have more than 1000 rows (in my case 9241 rows), it will select the first 1000 rows. This causes inconsistent heatmap visualization and deviate from expectations, since the data could not be spread evenly.

To overcome this limitation, then we can filter the data. In figure 8, I filtered the data based on earthquake magnitude between 3 to 8, and got 857 records. Furthermore we can also adjust radius, transparency and weight of heatmap. If a column is set as a weight, then the heatmap intensity will be multiplied by the value in that column.

Earthquake data filtering
Figure 8. Earthquake data filtering and adjustment
After filtering with some adjustments and satisfied with the heatmap visualization, then select Done. Congratulation!! Its done and the map is ready to be shared.



Publish and Share The Heatmap

A map can be published or shared. They are two different approaches.  Share means we give access for other user  whether a user can view or edit the map. To share the map, use share feature on the top right of the map page. If this feature is selected, we can set the permissions for the map, whether it is viewable or some users can edit. After the settings are done, a link will be given as shown in Figure 9. Copy and share the link.
Earthquake heatmap sharing
Figure 9. Earthquake heatmap sharing
To publish the map can be done by selecting a small triangle on the map tab, so that the menu appears as picture 10.
Publish an earthquake heatmap
Figure 10. Publish an earthquake heatmap
On the menu, select Publish, so that the window appears like picture 11. In this window there are several options, namely:
  • Send a link via email.
  • Use map frame to display the map on other web page.
  • Get HTML and Javascript code.
  • Publish to google drive.


Map publishing option
Figure 11. Map publishing option
Which one to choose? Certainly depends on your purpose. If you want to provide a map link, choose the first option. If the map will be displayed on other web page, choose the second one. If you want to get the HTML and Javascript code for further processing, then choose the third option. And choose the last option if you want to publish it into google drive.

That's all the way how to create, share and publish a heatmap using google fusion table. Hopefully it is useful for you, and please share it, if you think it is also useful for others. Look forward to hearing your suggestions and comments. Thank you.

0 comments :

Post a Comment