TCC2013GeospatialPDF - Tableau Customer Conference

advertisement
Tableau Customer Conference –
Geospatial Analytics
Presented by:
Grace Labriola & Steve Burger
Glabriola@tableausoftware.com
Sburger@tableausoftware.com
1
Copyright 2013 Tableau Software
Geospatial Analytics: Part 1
For Questions or Feedback
Grace Labriola
Glabriola@tableausoftware.com
2
Copyright 2013 Tableau Software
Click Steps
Screenshots
Hello and Welcome to Geospatial analytics –
We’ve broken this session into two parts. The first
hour will be focused on more introductory topics
specifically; data shape, basic mapping, data layers,
and a few tips in tricks to use these simple concepts
to make your geographic data look “pro”.
The workbook has been designed for you to be able
to follow along with the concepts that we will cover
in this session and for you to utilize as a point of
reference after returning home.
A completed version of this workbook and a how to
guide can be found [WHERE????]
3
Copyright 2013 Tableau Software
Click Steps
Screenshots
At Tableau we believe that building out maps with
your geographic data should be as quick and easy as
creating any other chart type and that viewing
derailed geographic breakdowns of your data on a
map will allow for better understanding than you
could gain from just spreadsheets or bar charts.
To facilitate this seamless geospatial analysis we
include built in recognition for many geographic roles.
These options (marked with a globe in the dimensions
pane) prompt Tableau to automatically generate
latitude and longitude you can use to create maps.
4
Copyright 2013 Tableau Software
Click Steps
Screenshots
Getting to the 30 second map:
Data shape is important to quickly and easily building
out maps within Tableau. One way to assure that you
are easily able to utilize your geographic information
is to have one of the aforementioned “geographic
roles” within your data set. This will allow you to
quickly build out various maps with just a few clicks.
For example the datasets we are working with for this
session have a Zip Code field. We
Exercise one: Filled Zip Code map
1.
To build out a map with this field, double click
on zip code.
2. There are multiple ways to create a filled map
in Tableau – you can utilize “show me”, the
“marks card”, or just add another field to color.
3. In this case adding “score” to color will create a
filled map based on the average score by zip
code.
Exercise one: Adding a Filter
1.
To create a single value filter based on year
add Inspection Date to the pages shelf and
from the dialogue box select “years”.
2. Right click on the pill and select “Show Quick
Filter”
5
Copyright 2013 Tableau Software
Click Steps
Screenshots
Extra: Animation with the pages shelf.
To show changes over time on a map it can often be
helpful to utilize the Pages shelf to animate a view.
Extra one: Pages self
1.
“Ctrl click” on” YEAR(Inspection Date)” from the
filter shelf and drag a copy to the pages shelf.
2. Make sure your filter is set to “All”
3. Press the play icon.
6
Copyright 2013 Tableau Software
Click Steps
Screenshots
Address level mapping:
Often when building out maps, especially for a smaller
area or region you will want to get to a more granular
level, mapping out specific locations of stores,
restaurants, schools, etc. In order to accomplish this
you will need to either have or find the Latitude and
Longitude for these locations and include them in your
data set.
In the case of the Austin Restaurants data set we are
using in this presentation the latitude and longitude
were included but not in a format that Tableau was
able to use. To fix this I edited the data set to have both
a latitude and longitude column.
Exercise two: mapping all locations.
1.
To construct a map using the non-generate
latitude and longitude make sure that Tableau
is recognizing these as a geographic field (that
the globe is present).
2. Ctrl select both and add them to the view.
3. Add Facility ID to level of detail and place Score
onto color.
7
Copyright 2013 Tableau Software
Click Steps
Screenshots
Extra Two: Creating a tree map.
There are many ways to show this information without
using a geographic component; one option is creating a
tree map.
Extra Two: Tree map.
1.
The fastest way to switch this from a point map
to a tree map is to duplicate the page and then
from “show me” select tree map.
2. From here you are then able to make it more
legible by adding a filter [in this case on Zip Code]
3. And change what it is sized/colored on [here
Avg(score) for size and Min(score) for color]
8
Copyright 2013 Tableau Software
Click Steps
Screenshots
Using KPI’s on a map:
One of the key components to effective visualizations is
assuring that your results are actionable. In this case we
may want to easily show which category each restaurant
falls into based on their minimum score.
Exercise Three: Creating a KPI.
1. Adding a KPI that will color each location will
enable you to easily see which locations are
performing poorly.
2. Begin by creating a calculated field; right click in
the dimensions pane and select “Create
Calculated Field”.
3. In the text box type: If Min([Score]) < 80 Then
"Poor" ELSEIF Min([Score]) < 90 THEN "Fine"
ELSE "Good" END - press okay.
4. This calculated field now appears in the
Measures pane and you will be able to add it to
color.
9
Copyright 2013 Tableau Software
Click Steps
Screenshots
Extra Three: Dynamic KPI –
In order to create a dynamic KPI (one where the users
are able to select values) you need to create 2 additional
parameters and a new calculation.
Extra Three: Dynamic KPI.
1. Create a new parameter – name it “Bad”, data
type is Float. Select “range” and set minimum as
63 and max as 85; with a step size of 1.
2. Create a new parameter – name it “Okay”, data
type is Float. Select “range” and set minimum as
85 and max as 95; with a step size of 1.
3. Create a calculated field: IF AVG([Score]) < ["Bad"
] THEN "Bad" ELSEIF AVG([Score]) < ["Okay"]
THEN "Okay" ELSE "Good" END
4. Add the calculated field to color and show both
parameter controls.
5. Make selections to see the viz update.
10
Copyright 2013 Tableau Software
Click Steps
Screenshots
Using sets on a map:
Now that you have built out some basic map views we
will cover how to better focus your visualizations, add
relevant data to build in depth, and best implement
end user functionality. There are many ways to
accomplish this within Tableau and over the rest of part
one will touch on just a few concepts that will allow
you to easily drill into your spatial data and get the
answers you and your colleagues are looking for!
One powerful way to focus in on an area or a specific
group of marks is to create a set. There are multiple
ways to build sets within Tableau – one option is to just
lasso a group of marks and select the paper clip from
the tool tip. However if your data updates regularly this
set is limited to just the marks you selected.
Exercise Four: Creating dynamic sets.
1. Right click on Zip Code in the dimensions pane
and select “Create Set”.
2. Type in Zip code 78701 and check box to select
that zip code.
3. Press okay
You’ve now created a dynamic set that will
automatically update with the data set to include new
locations within that zip code.
11
Copyright 2013 Tableau Software
Click Steps
Screenshots
Using Map layers:
Once you’ve built out a detailed map focused on a
smaller area it may be helpful to add more information
such as street names or zip code boundaries to give
users as better sense of location.
Exercise Five: Map Layers for added detail.
1. To access Tableau’s built in Map Layers – select
“Map” from the tool bar and then “Map
Options” from the drop down.
2. On the left hand side you will now be able to
select which options you would like to apply.
Mapping Layers are an option only available through
“online” maps and will not appear when in “offline”
mode.
12
Copyright 2013 Tableau Software
Click Steps
Screenshots
Using Data layers:
In order to gain further analyze data it is often helpful to
bring in more information perhaps adding census data to
maps in order to compare business growth to population
growth. Tableau works with Urban Mapping to provide
some built in Data Layers that allow you to easily
perform this type of analysis.
Exercise Five: Including data layers.
1. To access Tableau’s built in Data Layers you
follow the same process as for Map Layers select “Map” from the tool bar and then “Map
Options” from the drop down.
2. The default option is “No Data Layer” but from
the dropdown you have the option to select a
variety of Data Layers to build out a meaningful
view to you.
3. Adjust the “By” option to calculate a view that
makes the most sense for the visualization you
are working with. (down to the block level)
4. You are also able to edit the color legend from
the “Using” dropdown.
13
Copyright 2013 Tableau Software
Click Steps
Screenshots
Dual Axis Maps:
1. To create a dual axis map start with a filled zip
code map [see page 5].
2. Remove any field from color.
3. Duplicate the latitude on the rows shelf by:
holding down “Ctrl” selecting latitude and
dragging a copy next to it on the rows shelf.
4. From the marks card select “AVG(Latitude)” – so
you are only editing the first map.
5. To create custom regions make selections of the
marks either by holding down control or using a
lasso select hover over your selections and
create a group using the paper clip icon on the
tool tip. These marks will automatically color.
6. To edit the secondary map use the marks card to
navigate to “AVG(Latitude) (2)”.
7. Change this map from a filled map to a shape
map – and add facility ID to the level of detail
and place “AVG(Score)” onto color.
8. You should now have two different maps on the
same sheet to over lay one on top of the other
click on the second latitude on the rows shelf
and select “Dual Axis”.
14
Copyright 2013 Tableau Software
Geospatial Analytics: Part 2
For Questions or Feedback
Steve Burger
sburger@tableausoftware.com
15
Copyright 2013 Tableau Software
Click Steps
Screenshots
Welcome to the second part of Geospatial Analytics
with Tableau. I hope you are enjoying TCC 2013!
My name is Steve Burger and I am a Product
Consultant with the Commercial Central team in the
Austin, Texas office.
Today
16
Copyright 2013 Tableau Software
Click Steps
Screenshots
Open Tableau and Connect to Data Source
Connect to the TCC13 – Restaurant
Inspection Scores data source and the
Restaurant Inspection Scores worksheet
2. Check out the Latitude & Longitude from the
Dimension pane (Not the generated
measures). Notice anything amiss?
1.
I’ve thrown you a curveball here and intentionally set
you up with a ‘problem’ in the data. Latitude &
Longitude are explicitly named in the data source, but
Tableau is not recognizing them as Geo data types
(globes). It is seeing them as String data type (Abc).
What’s going on? How might you fix this?
This is a common ‘real world’ scenario. The
underlying data source has defined Latitude and
Longitude as String values. Fixing this is easy in
Tableau, no need to go back to the data source.
CTRL Select Latitude and Longitude and right
click, select : Change Data Type -> Number
2. Right click only on Latitude. Select
Geographic Role -> Latitude
3. Repeat for Longitude
4. Now you should have the globe icon
indicating that Tableau recognizes these as
Geo data types
1.
17
Copyright 2013 Tableau Software
Click Steps
Screenshots
Points Worksheet
1. Open the Show Me dialog
2. CTRL Click Latitude, Longitude and Restaurant
Name on the Dimensions list.
3. Select the Symbols Map option from the Show
Me card
4. Hide the Show Me card
5. To add greater detail, select the Map menu
then Map Options and check Streets and
Highways
6. Close the Map Options pane
7. Now, click & drag Restaurant Name from its
current position on the Level of Detail in the
Marks card to the Label encoding tile on the
Marks card
8. Right click the Sheet tab and select Rename
Sheet to Point Map
To create points on a map, we simply need Latitude,
Longitude and a Dimension that tells us something
about that point, such as a ‘Restaurant Name’.
Now you might have noticed that not all marks were
labeled. Tableau using ‘smart labeling’ to keep labels
from becoming cluttered and covering data points
when we have a tight grouping as we have here.
18
Copyright 2013 Tableau Software
Click Steps
Screenshots
Path Worksheet
1. Create a new worksheet
2. Connect to the TCC13 Restaurant Inspection
Scores data source
3. Select the #1 Cap Metro NoLa – SoCo table
4. Open the Show Me dialog
5. Hold down your Ctrl key and select Latitude,
Longitude (from the Measures window)
6. Click on the symbol map in Show Me
7. Hide Show Me
8. In the Marks pane, change Automatic to
Line
9. Move ID from Measures to Dimension pane
10. Right click Num of Riders on Measure pane
and select Convert to Discreet
11. Add ID to the Path encoding tile on the
Marks card
12. Select Map -> Map Options and under Map
Layers check Streets and Highways
13. Close Map Options pane
14. Select the Size encoding tile on the Marks
card and adjust to the second mark
15. Right click the Sheet tab and select Rename
Sheet to Path Map
So, a path is simply a series of points in a
sequence that are connected together.
In this example we’ve detailed the route of the
#1 Capital Metro bus that runs along Congress
Avenue
19
Copyright 2013 Tableau Software
Click Steps
Screenshots
Flow Path
1. Right click Path Map tab and select Duplicate
Sheet
2. Right click the tab and rename the sheet Flow
Map
3. Add Num of Riders measure to Size encoding
tile on the Marks card
4. Click the Size encoding tile on the Marks card
and move the slider up to the second crosshatch
Like Minard’s famous Map of Napoleon’s march, we
can use the path on the map to convey measure
value information. In Minard’s chart, the width or
‘thickness’ of the lines indicated the relative size of
Napoleon’s army, in our example the width details
the ridership at various points on the buses route.
20
Copyright 2013 Tableau Software
Click Steps
Screenshots
Polygons
1. Create a new worksheet tab
2. Connect to the TCC13 Restaurant Inspection
Scores data source.
3. Select the Downtown Districts
4. Move PolygonID and Order from Measure to
Dimension
5. Open the Show Me dialog
6. Hold down your Ctrl key and select Latitude,
Longitude (from the Measures window)
7. Select the Symbol Map from Show Me
8. Close Show Me
9. Select Analysis and click to de-select
Aggregate Measures
10. To add greater detail, select the Map menu
then Map Options and check Streets and
Highways
11. Close Map Options card
Notice that Tableau has placed Latitude and
Longitude in the measure field.
When we use these measures for our map, an
aggregation is applied. Remove the aggregation.
Select the ‘Analysis’ menu and click to de-select
‘Aggregate Measures’. Looks kind of like a star
constellation. It is each individual point that make up
the perimeter of our polygon’s
Now we just need to connect the dots and fill in the
shapes!
21
Copyright 2013 Tableau Software
Click Steps
Screenshots
Polygons: Continued
1. Select District from Dimensions and place on
the color encoding tile
2. Place PolygonID on the Level of Detail on the
Marks card
3. Change the Mark Type from Automatic to
Polygon on the Marks card
4. Place Order on the Path encoding tile on the
Marks card
5. Click the Color encoding tile and slide the
Transparency down to about 60%. Add a
border if you like
6. BONUS: Add Labels for the Districts. Hint: Try a
dual axis map using a copy of Latitude on the
Row shelf
7. Right click the sheet tab, select Rename Sheet
and call it Polygon Map
When you change the Mark Type from Automatic to
Polygon you might get some strange shapes. Don’t
panic! It’s just Tableau trying to figure out how to
enclose the Polygon. To fix this, we have the Order (of
the points) in our data.
22
Copyright 2013 Tableau Software
Click Steps
Screenshots
Radius Map
We are going to build a dynamic radius map to help us
filter our list of potential places to eat. The user will
define the distance, in the form of a radius; they want
to travel to find a restaurant. We may also include a
filter to aid the user further.
1. Create a new worksheet tab
2. Rename the tab Radius Map
3.
Select the Restaurant Inspection Scores
table in Data pane
4. Open the Show Me Dialog
5. CTRL Click Latitude, Longitude and Restaurant
Name on the Dimensions list
6. Select the Symbols Map option from the Show
Me card.
7. Hide the Show Me card
8. To add greater detail, select the Map menu
then Map Options and check Streets and
Highways
9. Close the Map Options pane
10. Move Facility ID Measure to the Dimensions
pane
11. Move Facility ID to the LOD
12. Add Restaurant Name to the Label encoding
tile on the Marks card
23
Copyright 2013 Tableau Software
Click Steps
Screenshots
Radius Map: Continued
So why did we place facility ID on the Level of Detail?
Because Tableau works from the aggregate level down.
‘Restaurant Name’ isn’t a sufficient level of granularity
to distinguish each instance of a restaurant uniquely.
For example, if the restaurant is part of a chain. I know
that my favorite; “Torchy’s Tacos” has more than one
location in the search area.
Illustrate this by pointing out number of Marks in lower
left and then dropping and re-adding Facility ID to LOD.
1. Click ‘Analysis’ -> ‘Create Calculated Field’ or
Right click in blank area on Dimension Pane and
‘Create Calculated Field’.
2. Enter calculation used for Circle calculation.
3. Title the Calculated Field, ‘Distance from
Tableau Austin’
A Radius Map is a great way to locate within a given
radius of a fixed point. The algebra behind this map is
the expression of a shape (in our case a circle) that was
mentioned in our discussion of Cartesian Coordinate
systems. The data needed are points (Latitude,
Longitude), and radius.
There is more than one formula you can utilize for this
calculation, Great Circle, Pythagorean Theorem or
Spherical Law of Cosines. I've used Spherical Law of
Cosines here.
24
Copyright 2013 Tableau Software
Click Steps
Screenshots
Radius Map: Continued
Now let’s use some simple KPI logic to create a color
differentiation between those restaurants within our
selected area and those outside.
In so doing, we are going to let the end user select
the parameter distance through the use of a
Parameter.
1. Click ‘Analysis’ -> ‘Create Calculated Field’ or
Right click in blank area on Dimension Pane
and ‘Create Calculated Field’.
2. Enter KPI Logic calculation
3. Create Parameter
4. Make Parameter ‘Integer’
5. Title the Calculated Field, ‘Distance KPI’
6. Place ‘Distance KPI’ onto the Color encoding
tile on the Marks card
7. Right click the Parameter ‘User Distance
Select’ and choose ‘Show Parameter Control’
8. (Optional) Right click on ‘Restaurant Name’
and select ‘Show Quick Filter’
9. (Optional) Select the Quick Filter dropdown
and select ‘Multiple Values (Custom List)’.
10. (Optional) Test with ‘Torchy’s Tacos’
25
Copyright 2013 Tableau Software
26
Copyright 2013 Tableau Software
Download