Sunteți pe pagina 1din 18

Google Fusion tip sheets May 2012.

The tip sheets are created by Tommy Kaas for Kaas & Mulvad
Kaas & Mulvad conducts training in Google Fusion.
tommy.kaas@kaasogmulvad.dk
www.kaasogmulvad.dk
Twitter: @tbkaas
Danish version: http://www.kaasogmulvad.dk/unv/fusion/KM-GF-DK.pdf

Few examples of different types of Google Fusion maps:
Wikileaks coverage in Guardian:
http://www.guardian.co.uk/world/datablog/interactive/2010/oct/23/wikileaks-iraq-deaths-map
Age distribution in Danish municipalities use of Google pie charts in the info windows:
http://www.google.com/fusiontables/DataSource?snapid=S269204PnI7
Same type of map but slightly more advanced pie charts and legends in the info window:
http://bit.ly/yBKG8O
Example of two maps combined with the help of tableslayerbuilder:
http://kaasogmulvad.dk/unv/fusion/layerbuildertest.htm
Example of a map with an integrated legend:
http://bit.ly/IEdNE0
Example of a map where table tags are used in the info window <table><tr><td> etc.:
http://bit.ly/yGWJ8J
And a very advanced example of Fusion Tables maps from Chicago Tribune:
http://media.apps.chicagotribune.com/chicago-census/index.html

Kaas & Mulvad | 03-05-12 | Google Fusion| Import of data

MEMO
1

What Why How
Google Fusion Tables is Googles answer to database-tables in the
cloud. You can upload tables to Fusion and merge them with other
table-data. You can visualize data and embed the result on a
website.
www.google.com/fusiontables

Who can
use
Google
Fusion?
You must have a Google-account. Ordinary Google Fusion maps
are free to use. If you build advanced maps (with use of API) you
will have to pay, if you have more than 25.000 pageviews in 90
consecutive days. If youre below that, its free too.


Upload a
table
You can upload from Google Spreadsheet or directly from your
own computer. You can upload tables from a number of different
file formats (including excel and csv) (max 100 MB). Theres a limit
right now on max 400.000 cells in a fusion-table.
Make the analysis of data before uploading, so youre sure of
what you want to display in Google Fusion.

Edit
columns
Normally its necessary to modify columns to be sure Google
Fusion uses them in the right way. It can be text, numbers, dates,
locations. Location is the format for geocoding in Google Fusion,
meaning this is what Google use to display dots or areas on a
map.

Change formats under Edit

Choose
right
format
Google can easily read an address as a location. Then write the
address in one single cell with a comma, as:


When address-data is imported, choose Geocode under File.

If you already have latitude and longitude in the data, you can
have them in 2 columns or write them in one field with a comma,
as:

This is a result of the geocodingen
of the address:

Share
table
To make visualizations visible you need to share. Choose share
and decide the level of visibility. If you want to make a map to
send or embed on a web site you need to make it accessible.


1
Kaas & Mulvad | 03-05-12 | Google Fusion| Import of data

MEMO
2


Make
View
The uploaded table is the basic. If you only want to give others
access to part of the table, you can do it under File and Create
View.


(If you find a public table, you can create a view of this table and
make your own vixualizations.)





Remove the acceptance for the fields, you dont want to share and
hide the view under a new name. You can choose to share this
new view and not the original table as described above.




Export
from
Fusion
Under File you can choose Export from here you can save as
a csv-fil. If you find a public table on the web, you may be able to
export the data.

Create
overview
When you upload tables you will be able to see the headlines in
fusion and in Google Docs. You will also be able to see other info
on the content. You can delete a table by clicking the x. If you
want to change then open the table and click onModify table
info.
Be sure to name tables so it is easy by the name to identify the
content.

See
tables
from
other
people
You can search and find public tables in the Fusion Tables public
table search:



http://www.google.com/
fusiontables or

http://www.google.com/
fusiontables/search
2
Kaas & Mulvad | 30-04-2012 | Internet | Google | Create maps from data in Google Fusion Tables

MEMO
1

What Why How
Show data
on a map
Often data has a geographic angle, which we first can see clearly when
data is put on a map.
Data can be visualized on a map as icon markers if data contain
addresses or coordinates. And the data type of the specific field in the
fusion table has to be location.
Check other memos on
Google Fusion too
An
example
In this example our table with municipalities contains a name, a location (latitude and longitude) and
one single value, the population in 2010. We want to create a map with this information.

Share We share the visualization. Well make it visible if you know the link.


Choose
map
We want to visualize the data as a map.

Study the
result
The map should show up now. It it doesnt show up you may have to
zoom a little bit.


The info
window
The content of the info window will default be the text from all fields in
the dataset. In this case:




Above the map youll se a
link to different tools, you
can use, when you want
to change the
appearance. To change
the content of the info
window, press Configure
info window:


3
Kaas & Mulvad | 30-04-2012 | Internet | Google | Create maps from data in Google Fusion Tables

MEMO
2

We want to change the info window. We dont need coordinates, and
we may want a text which explans that the number is a population. Its
easy to fix.
Configure
info
window

Automatic is the default showing of all content. If you want to decide what should be visible,
choose Custom. Well do that now:
You can write your own text, and you can use information from the dataset. For example if you want
to insert the name of the municipality, just write {kommunenavn} the name of the field. And if you
want to insert the population, just write {2010} the header row of the population field. The curly
braces are necessary if fusion is to understand that we refer to fields from the dataset.
In the column at the left we are reminded of the names of the header rows its easy to forget
When you doubleclick on a name, it will jump into the box at the right.
I only write <br> when I want a new line.



When you are done, youll save and close this window. And you must now click on the map and
check if everything is satisfactory.




In this case it looks good. The text appears on two lines, because I inserted
the code for linebreaks <br>. Else all text would have appeared on one
single, long line.

Size The info window has a fixed size, but its possible to write a code that will
change the size of the window. For example:


4
Kaas & Mulvad | 30-04-2012 | Internet | Google | Create maps from data in Google Fusion Tables

MEMO
3

<div style:=width:300px; height:210px>
</div>

The lines has to be the first and the last line in the box. Change the numbers
and youll change the size of the info window (in pixel)

Design Use common html code to change the design. For example:
<b>This text will be bold</b> bold
<i>This text will be italic</i> italic


Insert
pictures
This code will get and in the info window show a picture file:
<img src="http://www.kaasogmulvad.dk/picture.jpg">
You can choose to replace parts of this address with a reference {} to a filed
in the table where the name of the picture may be placed.

Insert links

To insert link in the info window:

<a href=http://www.kaasogmulvad.dk>Click this text</a>
A blue link will appear: Click this text which will lead to the site.

Or we can in the construction of the link write a reference to a field in the
table.
This is useful if you for example have a company ID as one of the fields, and
you want to create a link in the info window which makes a live query in a
database (or perhaps a query in Google).


Another idea: If you have a field with the lat, long coordinates, you could in
the info window create a link which gives acces to Google Street View.














Change
icons
Default we get red circles on the map. But we can change this.
Under Configure styles just above the map its possible to change all
icons to another type. Or we can let a value in the dataset reflect the colors.

Its alts possible to write the name of the icon the specific address should
appear as. We have a list of icons to choose from.

(Click on the icon to read its name. This name should be written in the
dataset).
http://www.google.com/fusiontables/DataSource?snapid=99003

If we use this solution, we must choose Column under Configure styles
og tell Fusion which column contains the name of the icons.


5
Kaas & Mulvad | 30-04-2012 | Internet | Google | Create maps from data in Google Fusion Tables

MEMO
4



Embed You can choose to distribute the map link to others, but maybe you want to
show the map as a part of another site. In that case you need the
embeddable link.
Click this (just above the map):


Copy the entire code:


You can paste this code, if you perhaps write a blog entry etc.
The two first numbers controls the size of the map on you blog page.
Remember, that your own page or cms can give some limitation and you
must change and adjust the code until the layout and design is satisfactory.

Full screen
map
If you want to show the map as a full screen without any kind of menues,
you can still use the embeddable link, but take only the part I have showed
in italic in the example below this text:
<iframe width="500px" height="300px" scrolling="no"
src="https://www.google.com/fusiontables/embedviz?viz=MAP&q=select+
col2+from+2782166+&h=false&lat=56.18523859161751&lng=15.0180500
70875006&z=7&t=1&l=col2"></iframe>


You can change the
centre of the map (the
lat,long) and the zoom
level (the number after
z=)
6
Kaas & Mulvad | 1.5.12 | Internet | Google | Create maps based on polygons in Google Fusion

MEMO
1

Hvad Hvorfor Hvordan
Understand
polygons
Unlike points, a polygon is an area on a map - typically a postal
district, a municipality, region or even a country. Different types of
map applications define polygons in different ways. In Google Fusion
a polygon is built up as a kml file.
The kml file is a file made up of a large number of points - each
defined by a longitude and a latitude. The points is in fact a very long
row, which together form the outline of the polygon. There may be
several separate polygons that together are grouped together into a
single polygon - for example, a municipality that has one or more
islands.
Therefore do not be surprised that a table with municipal polygons
may have more rows than the total number of municipalities.
In the Fusion-table youll
find the polygon in one
single field. It will typically
look like this:

Get access
to polygons
You can be lucky that someone has already imported the required
polygons to Google Fusion and made the result public. You can try
searching for the polygons in the search box.

Find the search field here:
google.com/fusiontables

Get access
to polygons
via shape
files
You can find the polygons on the web. National authorities may or
may not have created polygons for regions, municipalities, postcodes
etc. Very often they will appear as "shape files"
Shape File is a vector data format developed by the company ESRI.
If an authority uses the map application ArcView, they work with
shape files. These are easy to convert to kml and Google Fusion.
Just ask authorities whether they will share their shape files with
you.
Example from Denmark:
Free shapefiles from the
authoritites:

http://www.kms.dk/Produk
tkatalog/DAGI/
Convert
shape files
There are several places you can convert shape files to kml - a site
which is easy to use is shpescape.com. You make sure that your
shape file (which is actually a folder with several files) is located in a
folder that is zipped. Upload it at shpescape.com. You give the site
permission to access your Google Fusion account. And the converted
file will appear in your list of Google documents when it is ready.
Be aware that it may take some time. Sometimes there is a queue,
and if it is a very big shape file you work with, it can also take some
time to get it converted.
http://www.shpescape.com


Its necessary to press
Grant access if the
conversion is going to
work:


Other
sources
Do you work with maps of foreign countries, this site is a good source
for free shape files. For each country youll typically find two to four
different administrative boundaries.(Counties, municipalities etc)
http://www.diva-
gis.org/gdata

Find the
result
When the shape file is imported, shpescape.com will show a link you
can click and you are automatically transported to your own list of
Google documents, where a table with all data from the polygons
now can be found.





7
Kaas & Mulvad | 1.5.12 | Internet | Google | Create maps based on polygons in Google Fusion

MEMO
2


Use
polygons
Polygon files can be visualized itself as a map, but its not that
interesting until you combine the map with values. One of the fields
in the polygon table typically contains a code it could be an ID of
the county, municipality etc.
The dataset you want to visualize must contain the same ID so you
can merge the two datasets.

Combine
datatable
with polygon
table
Remember the name (or copy the link) of the polygon table. Typically
you will have the data table open and press Merge.



In the window at the left hand side, you will see the fields of the
table you have open at the moment. At the right you can see the
fields of the polygon table you want to merge into the data table.
Its now very important that you with the mouse choose which ID the
two tables have in common. In this example (Danish municipalities)
the common field is an ID. The ID will be the zipper which will
merge the two tables securely together. Through Select subset I
can choose exactly which fields which will go into the new table Im
about to create. Ill give the new table a name and press Merge
tables.



8
Kaas & Mulvad | 1.5.12 | Internet | Google | Edit the design of polygon maps in Google Fusion

MEMO
1


What Why How
More
possibilitites
In the case of polygons, one can select to color them in various ways.
The color of the area may reflect a property / quality - eg victory to
left wing or right wing politicians.
It may also be that the color should reflect a value in a subset of data
- the more bankruptcies, the darker colors.

Find your
angle
Regardless of what the possibilities are, it's important what you want
to visualize what the journalistic angle?

Kend dine
data
Before the visualization you should study your data carefully. Which
field in the dataset do you want to use when coloring the map? What
is the highest / lowest value in the column? Are all the values
clustered within a narrow range, or are they spread much? It may
have some bearing on how the intervals will look like.

Visualize the
data
Press Configure styles and start. A dialogue box will appear:

Rember to click under Polygons or nothing will happen.
Do you want to color the map, then start with Fill color.
You have four choices:


Choose the
method
Fixed gives one color for all polygons. Column is useful if the
dataset in one specific column has a colorcode eg #FF0000 which
gives a red color.
"Buckets" is the way to go if you need intervals. (Remember to set
the lowest and highest value - default is 0 - 100) and you can choose
exactly the color you fancy.
"Gradient" colors the map - from light to dark - in 8 colors. Again
please remember to fill in the highest and lowest values from your
dataset.
Under "Buckets", you can also easily create a smooth color gamut -
and it is only under "Buckets" that one can determine the size of the
intervals. It may be important if you want to create a legend for your
map.
Youll find many lists with
hexadecimal color codes
on the web for example
this:
http://www.december.com/
html/spec/colorsafe.html
Legend and
explanation
Unfortunately there is no way to make a legend in the simple type of
fusion maps, we work with here. A relatively easy solution may be to
create a small picture with colored boxes and explanation, and then
paste it above or below the map with a little explanation. See the
example on the right. Se the map live: http://bit.ly/yGWJ8J

There are also other more advanced options to create a legend by a
bit of programming. See this example:
http://www.kaasogmulvad.dk/unv/fusion/dropdown/aeldre.html

9
Kaas & Mulvad | 30-04-2012 | Internet | Google | Combine maps in TablesLayer Wizard

HUSKESEDDEL
1

Hvad Hvorfor Hvordan
Maps can be
combined
Sometimes we want to combine maps.Perhaps maps with several types
of icon markers. Or perhaps a map with polygons and a map with icons.
Perhaps we would like one map with two different types of info
windows. Or we need a way to let the users search the content of the
map.
To achieve all this we use the free tool: Fusion Tables Layer Builder.

http://bit.ly/Jsxsoz


An examle:






Limitation





Possibilities
This map was built in Fusion TablesLayer Builder. I have combined two
layers (two maps).

Its possible to combine max 5 layers into one in this wizard.
The information windows will be those designed in each map. You will
have to finish the design of each map in Google Fusion. The wizard cant
change the design of the maps.

If you for instance need more than one type of information windows in a
map, you can divide the points/polygons in several fusion tables and
several maps. In each map you can design the information windows and
later combine the maps into one map in the wizard.

Preparations Finish the maps. You will be able to change them later. Find the Numeric
ID for each map. Find them under File and About.


Choose the
order of the
layers
The order can matter. If you want to combine a polygon maps with a
map with icons, start with the polygons. In that way the polygons will be
placed underneath the icons. You dont want the polygons to be placed
on the top of the icons, as it would be difficult to see color differences
that way.

The first layer Under Your table id you write the ID for the first map. If the dropdown
menu near Location Column is grey, press Put Layer on Map.
Choose the Location field in your data. If it is a polygon layer it typically
will be the field with the KML. If its a map with icons, it will be the field
Google already geocoded. In this map the headline of the field is
geometry.

10
Kaas & Mulvad | 30-04-2012 | Internet | Google | Combine maps in TablesLayer Wizard

HUSKESEDDEL
2


When Location Column is chosen, press once again Put layer on map,
before the map is visible under Preview.
Two types of
searches
If the users shall be able to search the content of the map, you have two
possibilities. Text or Select-based search. Text-based search is a free text
search in a field you specify. Select-based search will give you a
dropdown menu where you can choose.

When Text-based is chosen, you will specify the column to query and the
text which will be visible in front of the search field.








Example of
select-based
search
In this example we choose select-based search. In the field with the
header Resultat in the data, we have three types of Results:



The dropdown below the map will look like this:



11
Kaas & Mulvad | 30-04-2012 | Internet | Google | Combine maps in TablesLayer Wizard

HUSKESEDDEL
3


Add another
layer
Press Add Layer to add a new layer this will be combined with the
first. Fill the fields in the same way as you just did with the first.
You can combine max 5 layers this way.



Adjust the size
and layout
Under Edit map you can adjust the size of the map. Use your mouse to
control the exactly appearance of the map. Remember to press Update
Map. The code in the bottom of the page will reflect the changes you
do.
.


Adjust the
layout and
design
You can adjust a few more things when using this wizard. Which details
from the map do you want visible and should the map be more grey
or more colorful.

Press:

To see how the map
looks after your
changes.
Copy the code In the bottom of the page the code changes reflecting your changes.
When you are done, highlight the code and copy it.
You can just paste it in a text file, give it a name with the file extension
.htm og view it in a browser.
Do you want to embed the map in a web site, youll have to do this in
two steps: First make the map. Secondly use iframes in you own site to
create the hole where you want to view the map.


Example of a map:
http://kaasogmulvad.dk/unv/fusion/layerbuildertest.htm

The same map embedded in a site:
http://www.kaasogmulvad.dk/nicar12/eksempel-pa-embedded-kort/

The iframe code, we have used in this example, looks like this:

<iframe width="465px" height="615px" scrolling="no"
src="http://www.kaasogmulvad.dk/unv/fusion/layerbuildertest.htm">
</iframe>

12
Kaas & Mulvad | 5.5.1203-05-12 | Google Fusion| Import of data with latitude and longitude

EXERCISE
1




What Why How
Prepare a file for
upload
Download the data via the link on the right.
Check the content of the file. It is all beneficiaries of farm
subsidy on the island Fyn in Denmark. (3934 records)

Save it on your computer (and make sure you remember where).
http://bit.ly/IoRoYh
(Excel spreadsheet)

http://bit.ly/KWC1vw
(csv)

Upload the file as a
table to Google
Fusion


Give the table a good name. Check field types. Make sure, that
Google Fusion understand that lat/long are locations and will be
used when the beneficiaries are placed on the map.
www.google.com/fusiontables


Visualize the data
as a map

Lets see what the map looks like.
The design of the
map
How do you want the map to appear? Think about which icons
to use and which colors.

You can perhaps give the icons colors, which reflects the
number in the amountEuroSubsidy column in the dataset.
Perhaps:
From 0 5000 white
5000 10.000 yellow
10.000 50.000 orange
50.000 100.000 red
100.000 200.000 blue
200.000 300.000 black
Configure styles
The design of the
info window
How do you want the info window to appear? Which story do
you want the users to read about each of the beneficiaries?

Configure info window
Get embed-code Click Share- choose Unlisted and then get the embed-code.
Save that in a text file in your project folder.
If you have a map you want to show to the rest of the class,
please invite post@kaasogmulvad.dk


13
Kaas & Mulvad | 5.5.1203-05-12 | Google Fusion| Import of data geocode addresses

EXERCISE
1



What Why How
Download and
study data
Download the Excel-file via the link.
Open the document and check the content. The list is the 100
largest beneficiaries of farm subsidies in Denmark.

Does it have all the necessary information we need to put it on
the map? Is it structured the right way?


Save it on your computer (and make sure you remember where).
http://bit.ly/IoPVm0
(Excel spreadsheet)

http://bit.ly/IHKqm8 (csv)

Prefare the file for
upload to Google
Fusion
If we want Fusion to geocode addresses, we need to merge the complete address into one single
column before upload.
Open your spreadsheet, add another column and use a formula to gather the total address for each
row.
You can for example use this technique:



Change formulas to
values
Its a good idea to change the formulas you just created. We just want text instead. Do like this:
1) Highlight the column with the formulas.
2) Copy the highlighted area
3) Right click in the highlighted area choose Paste special
4) Remember to choose Values in the dialogue box
Upload to Google
Fusion
Give it a good name. Check field types. Check locations.
Geocode the
addresses
Either under files and gecode or just click on visualize and map
Check the result of
the geocoding
How difficult will it be to fix?
Check the map Look at the map, check some of the beneficiaries. Does it look
right? Are they placed correct?


If necessary: Make
corrections by
hand
Look at the data in table view. Do you see addresses,
highlighted with yellow color? If you do and want to correct
them: Click on the globe symbol at the right hand side of the
address. Decide where you want the icon to be placed on the
map.


Configure info
window
Work to get a nice view in the info window. Decide what you
want your users to see.

Configure styles Think and work to get the right levels and colors.
14
Kaas & Mulvad | 5.5.1203-05-12 | Google Fusion| Info window with links to live queries in external databases

EXERCISE
1










What Why How
Open the fusion
table we created in
the first session
We created a map with >3000 beneficiaries on the Danish
island Fyn. Open it.
Notice that every recipient has a so called CVR number
(column A in the data set). A CVR number is the general Id
number for business entities in Denmark.

If you dont have your own data
set uploaded, you can use this:
http://bit.ly/IrtRHG

If you open this, you have to
create your own view and open
this.
Create a link to
query in the Info
window
We want to create a link in the info window we want to take
the CVR id and query the number in the database at cvr.dk.
Check with a CVR from the dataset.

Put the number in the search field and check the URL:
http://www.cvr.dk/Site/Forms/PublicService/DisplayCo
mpany.aspx?cvrnr=25952642


Use this info and construct a link that will take any CVR number
and build a working URL.


Build a similar link
that creates a
Google search for
any beneficiary

Try a simple query in Google maybe your own name. Check
how Googles URL is constructed.

Use that knowledge and construct a link, you can show in the
info window and which lead to a search for the name of the
beneficiary in Google.

15
Kaas & Mulvad | 5.5.1203-05-12 | Google Fusion| Create a map with polygons Farm subsidies in Denmark

EXERCISE
1




What Why How
Prepare a file for
upload
Download the data which for each of the 98 municipalities in
Denmark has the ID, the name of the municipality and the
amount of Farm subsidies received by beneficiaries with an
postal address somewhere in the municipality.
http://bit.ly/IJNQVr
(Excel spreadsheet)
Upload the file as a
table to Google
Fusion


Upload it check the import. Does it look ok? docs.google.com


Find the polygon
template
Search for a public fusion table, called danske kommuner
Open it and check, that the column with the ID in both tables
have the same datatype (check in Edit - Modify columns)
www.google.com/fusiontables/

Merge the tables
into one
Copy the url of the polygon table.
Open your own data table in fusion.
Merge into a new table save under a new name.
Make sure that the common key (the municipality ID) are
chosen in both tables.

Visualize the data
as a map

Open your new merged result and visualize it as a map. Color
the municipalities to reflect the amount received.
Think about how the map best communicates the story and
your angle.
Configure styles
The design of the
info window
If you have time work with the content of the info window. Configure info window
Share Share with post@kaasogmulvad.dk then I will be able to
show your map for the class.

16
Kaas & Mulvad | 5.5.1203-05-12 | Google Fusion| Combine two maps into one with the layerbuilder wizard

EXERCISE
1




What Why How
The exercise If you have followed the previous sessions you should now have
at least two Google fusion maps:
1) A map with icons all beneficiaries on the Danish island Fyn
2) A map with polygons showing Danish municipalities
The exercise is to combine the maps into one single map,
showing both municipalites and icons.
If you dont have your own maps,
you can use these instead:
Icons: http://bit.ly/IrtRHG

Polygons: http://bit.ly/JYdwxY

If you do this, you must create
your own views of the tables and
find the IDs of those views and
use them the exercise.
Open the
tablelayerbuilder
wizard
Use the instruction in the memo and combine the two maps. The wizard:
http://bit.ly/Jsxsoz

Create a map When you are done, designing the new map , copy the code in
the lower part of the page to a simple text file Notepad or
similar and save it under the name map.htm on your
computer.
If you use mac you might have to use get an application like
TextWrangler or similar.
TextWrangler:
http://bit.ly/J18cad

Check the map Open your map in a browser and check it design and
functionality.


Experiment If you have time, try some more try the search boxes.
Or find public tables and combine them. (Then you might have
to create your own wiews first)

Share Share with post@kaasogmulvad.dk then I will be able to
show your map to the class.

17

S-ar putea să vă placă și