本教程将引导您完成在 Tableau 中创建地图时可能执行的一些常见任务。

您将学习如何连接并联接地理数据;在 Tableau 中设置该数据的格式;创建位置分层结构;构建和呈现基本地图视图;以及在路线上应用关键地图特征。

如果您不熟悉 Tableau 中的地图构建功能,从此处开始学习非常适合。

Step 1: Connect to geographic data

空间文件或文本文件

You can work with geographic data by connecting to spatial files, or you can connect to location data stored in spreadsheets, text files, or on a server.

Spatial files, such as a shapefile or geoJSON file, contain actual geometries (points, lines, or polygons), whereas text files or spreadsheets contain point locations in latitude and longitude coordinates, or named locations that, when brought into Tableau, connect to the Tableau geocoding (stored geometries that your data references).

可通过连接到空间文件来处理地理数据,或者可以连接到存储在电子表格、文本文件中或服务器上的位置数据。

空间文件(例如 Shapefile 或 geoJSON 文件)包含实际几何图形(点、线或多边形),而文本文件或电子表格包含经纬度坐标格式的点位置,或者包含在引入 Tableau 时将连接到地理编码(数据引用的存储几何图形)的指定位置。

位置名称将根据您分配给字段的地理角色引用存储在 Tableau Map Service 中的几何图形。

Step 2:Join your data

Joining is a method for combining the related data on those common fields. The result of combining data using a join is a virtual table that is typically extended horizontally by adding columns of data.

Joining is often necessary with geographic data, particularly spatial data.

Step 3: Format your geographic data in Tableau

3、地图格式

Depending on the type of map you want to create, you must assign certain data types, data roles, and geographic roles to your fields (or columns).

For example, in most cases, your latitude and longitude fields should have a data type of number (decimal), a data role of measure, and be assigned the Latitude and Longitudegeographic roles. All other geographic fields should have a data type of string, a data role of dimension, and be assigned the appropriate geographic roles.

Sometimes Tableau does not get these data types right, and you must edit them. For example, Tableau might assign a Postal Code column a data type of Number (whole). To create map views, your Postal Code data must have a data type of String.

 

Assign geographic roles to your geographic data

4、地理角色geographic role

In Tableau, a geographic role associates each value in a field with a latitude and longitude value. When you assign the correct geographic role to a field, Tableau assigns latitude and longitude values to each location in that field by finding a match that is already built in to the installed geocoding database. This is how Tableau knows where to plot your locations on the map.

 

Step 4:Create a geographic hierarchy

This is not required to create a map view, but creating a geographic hierarchy will allow you to quickly drill into the levels of geographic detail your data contains, in the order you specify.

Step 5: Build a basic map

Now that you have connected to and joined your data, formatted your data, and built a geographic hierarchy, you are now ready to start building your map. You will start by building a basic map view.

Step 6: Change from points to polygons

The default map type in Tableau is often a point map. When you have geographic roles assigned to your geographic data, however, it’s easy to change those data points to polygons.

On the Marks card, click the Mark Type drop-down and select Filled Map.

Step 7: Add visual detail

You can add measures and dimensions to the Marks card to add visual detail to your view. In this example, you will add color and labels to the view.

Add color
Add labels

Step 8: Customize your background map

The background map is everything behind your marks (borders, oceans, location names, etc.) You can customize the style of this background map, as well as add map layers and data layers. In addition to customizing the background maps, you can also connect to your own WMS server or Mapbox map.

  1. Select Map > Map Layers.The Map Layers pane appears on the left side of the workspace. This is where all background map customization happens.
  2. In the Map Layers pane, click the Style drop-down and select Normal.The background map updates to look like this:

Step 9: Create custom territories

Step 10: Create a dual axis map

Step 11: Customize how others can interact with your map

Now that you have created your map view, you can customize how people will interact with it. For example, you might now want anyone to be able to zoom in or out of your map, or pan. Or perhaps you want to display a map scale? You can customize these two options and more in the Map Options dialog box.

 

And that’s a wrap! Your map view is now ready to be presented or combined with another view in a dashboard. For more information about dashboards, see Create a Dashboard.

 

 

来源:官网地图文档