0% found this document useful (0 votes)
4 views13 pages

U4 - Tableau

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 13

Unit 4

Prepared by: Varun Rao (Dean, Data Science & AI)


For: Data Science - 2nd years

The most common way that spatial data is processed and analyzed is using a
GIS, or, geographic information system. These are programs or a combination
of programs that work together to help users make sense of their spatial data.
Spatial data is also known as geospatial data, spatial information or
geographic information. Spatial data may be classified as scalar or vector
data. Each provides distinct information pertaining to geographical or spatial
locations.

Build a simple point map

1. Navigate to a worksheet.
2. In the Data pane, open the Location folder and double-click State.
A map view is automatically created because the State field is a
geographic field.
3. From the Orders table in the Data pane, drag Sales to Size on the Marks
card. The data points on the map update to show the amount of sales
proportionally.

4. Select Maps > Background Layers.


5. In the Background pane, click the Style drop-down and select Normal.
6. Under Background Map Layers, clear Country/Region Names. The
background map updates with the new settings.
How to edit the current view
1. In the Data pane, open the Location folder and double-click State.
A map view is automatically created.

2. On the Marks card, click the Mark Type drop-down and select Map.
The map view updates to a filled (polygon) map.
3. From the Orders table in the Data pane, drag Sales to Color on the Marks
card. The polygons on the map update to show the amount of sales using
color.
Plotting your own locations on a map
To map data points onto maps, you need both latitude and longitude coordinates in your
data. You can even create custom maps in Tableau for just about anything. You can either
add the specific longitude and latitude to your source data, or you can import custom
geocode lists into Tableau.

Adding Custom Geocoding to Your Data source


Custom geocoding is a more flexible way to plot your data on a map. Custom geocoding is
available for all workbooks on a computer once the custom geocoding data is imported. The
custom geocoding data will be copied into any packaged workbook (.twbx) or published
workbook that uses a custom geographic role. This will make the workbooks about 40 MB
larger.

In custom geocoding, you can use additional columns to define larger geographic locations.
For instance, if you are creating a set of US census tracts, you may need to define which
US county they fall in. You can include additional columns to define larger geographic
locations in the import file.

You can also use multiple files for multiple geographic roles that have a matching
relationship, meaning they share larger geographic data, such as country or state/province.
Once the custom geocoding data is imported, you will see additional geographic roles that
can be assigned to your geographic data.

You must obtain geographic coordinates in the form of longitude and latitude values that
you provide to your data set in order to add custom geocoding to your data source.

Finally, custom geocoding lets you add additional places to an existing geographic role,
such as adding new cities to the city role. It also allows you to define a hierarchy of
geographic roles that extends the built-in hierarchies (e.g. census tracts in counties) or
defines a new hierarchy (e.g. sub-territories in the territories).
Replace Tableau’s standard maps
There are different ways to replace a standard map in Tableau. Here
are a few ways.

Select a Tableau background map style


When you are connected to the Tableau background map, you can choose
between six built-in background map styles: Normal, Light, Dark, Streets,
Outdoors, and Satellite. You can see these styles below:

Light Dark
Normal

Streets Outdoors Satellite


To select a Tableau background map style:

1. Select Map > Map Layers.


2. In the Map Layers pane on the left-hand side of the workspace, under
Background, click the Style drop-down menu, and then select a
background map style.

Import your own background map


If the built-in Tableau background map styles don't meet your needs, you can
import your own background map from a Web Map Service (WMS) server or a
Mapbox map.
To import your own background map:

1. Select Map > Background Maps > Map Services.


2. In the Map Services dialog box, click Add, and then select to add WMS
servers or Mapbox maps.
3. Follow the prompts to connect Tableau to the map service of your choice.
When finished, click Close.
4. Select Map > Background Maps, and then select the background map
you want to use.
The map updates to include the background map you choose.

Add a static background image


In addition to importing your own background map, you can add a static
background image to your workbook and plot your data on it. For example, you
can take a Google Map image and plot your data on it.

Shaping data to enable Point-to-Point mapping

Connect to spatial files

1. In Tableau Desktop: click the New Data Source icon and select Spatial
file.
In Tableau Online or Tableau Server (Creator role): Select Create >
Workbook. Select the Files tab.
2. Navigate to the folder that contains your spatial data, select the spatial
file you want to connect to, and then click Open.
Note: To connect to spatial files, you must include all of the following files in
the same directory:

● For Esri shapefiles: The folder must contain .shp, .shx, .dbf, and .prj
files as well as .zip files. When connecting to Esri shapefiles in Tableau
Online or Tableau Server, the file must be packaged in a .zip.
For Esri File Geodatabases: The folder must contain the File
Geodatabase's .gdb or the .zip of the File Geodatabases’s .gdb.. When
connecting to Esri shapefiles in Tableau Online or Tableau Server, the
Esri File Geodatabase must be packaged with the extension .gdb.zip.
● For MapInfo tables (Tableau Desktop only): The folder must contain
.TAB, .DAT, .MAP, and .ID or .MID and .MIF files.
● For KML files: The folder must contain the .kml file. (No other files are
required.)
● For GeoJSON files: The folder must contain the .geojson file.(No other
files are required.)
● For TopoJSON files: The folder must contain the .json or .topojson file.
(No other files are required.)

Tableau supports connection to the following spatial data sources:

● Shapefiles
● MapInfo tables
● Keyhole Markup Language (KML) files
● GeoJSON files
● TopoJSON files
● Esri File Geodatabases

If you have WKT (well known text) in a CSV or Excel file, you can import the
data and then translate it to spatial data on the Data Source page.

Join spatial files

1. Open Tableau and connect to the first spatial data source.


2. Open the join canvas for your data source by double-clicking the table on
the canvas to open the join canvas (physical layer).
3. On the upper-left side of the Data Source page, under Connections, click
Add.
4. In the Add a Connection menu that appears, connect to your second data
source. Drag the second data source onto the join canvas.
1. Click the Join icon.
2. In the Join dialog box that appears, do the following:
○ Select a join type.
Under Data Source, select a spatial field to join by.

So when do you know if you should use a map view?


One rule of thumb is to ask yourself whether or not you could answer your
question faster, or easier with another visualization. If the answer is yes, then
perhaps a map view is not the best visualization for the data you’re using. If the
answer is no, then take the following into account:

Maps that answer questions well have both appropriate data representation,
and attractive data representation. In other words: the data is not misleading,
and the map is appealing.

If your map is beautiful, but the data is misleading, or not very insightful, you
run the risk of people misinterpreting your data. That’s why it’s important to
create maps that represent your data accurately, as well as attractively.

Get your geographic data into Tableau

● Create Tableau Maps from Spatial Files: If you have Esri Shapefiles,
Mapinfo tables, or KML files, start here.
● Geocode Locations Tableau Does Not Recognize and Plot Them on a
Map: If you have data that Tableau does not recognize, start here.
● Blend Geographic Data : If you have geographic data you want to blend
with another data source, start here.
What types of maps can you build in Tableau?
With Tableau, you can create the following common map types:

● Proportional symbol maps


● Choropleth maps (filled maps)
● Point distribution maps
● Heatmaps (density maps)
● Flow maps (path maps)
● Spider maps (origin-destination maps)

Proportional symbol maps

Proportional symbol maps are great for showing quantitative data for
individual locations. For example, you can plot earthquakes around the world
and size them by magnitude.

Choropleth maps (filled maps)

Also known as filled maps in Tableau, Choropleth maps are great for showing
ratio data. For example, if you want to see obesity rates for every county across
the United States, you might consider creating a choropleth map to see if you
can spot any spatial trends.

Point distribution maps

Point distribution maps can be used when you want to show approximate
locations and are looking for visual clusters of data. For example, if you want to
see where all the hail storms were in the U.S. last year, you can create a point
distribution map to see if you can spot any clusters.

Heatmaps (density maps)

Heatmaps, or density maps, can be used when you want to show a trend for
visual clusters of data. For example, if you want to find out which areas of
Manhattan have the most taxi pickups, you can create a density map to see
which areas are most popular.
Flow maps (path maps)

You can use flow maps to connect paths across a map and to see where
something went over time. For example, you can track the paths of major
storms across the world over a period of time.

Spider maps (origin-destination maps)

You can use a spider map to show how an origin location and one or more
destination locations interact. For example, you can connect paths between
metro stations to plot them on a map, or you can track bike share rides from an
origin to one or more destinations.

You might also like