Spatial Parameters and Operators

Spatial parameters

You can create a spatial parameter to use in calculations from spatial data. You can load spatial parameters from a data source, or you can use well-known text (WKT) to create spatial parameters in Tableau. A spatial parameter can be a point, polygon, multipolygon, line, or a homogenous collection of these types. You can use spatial parameters the same way you use other parameters in Tableau, such as parameter controls, parameter actions, and dynamic values.

Note: Spatial parameters can only be created with fields from spatial data, such as latitude and longitude coordinates. They can’t be created with text string fields. For example, a country field is a text string that may have a geographic role applied, but it’s still a text string.

Create a spatial parameter

To create a parameter from the Data pane:

  1. Click the dropdown arrow in the upper right corner and select Create Parameter.

    Alternatively, you can right click a field and select Create Parameter.

    Dialog box to create a parameter.

  2. In the Create Parameter dialog box, name your spatial parameter.

  3. Open the Data Type dropdown, and select Spatial.

    Data type dropdown in dialog to create a parameter with Spatial type highlighted.

  4. Under Allowable Values, select All or List.
    Choosing List allows you to populate the values by using WKT or from a field. For List domain parameters, we recommend using an alias when naming your parameter. For example, instead of naming your spatial parameter POINT(-73.9856 40.7484079), name it Empire State Building. The use of an alias is only available for List domain parameters.
  5. Open the dropdown menu next to Add values from and select a field. You can also type the WKT values directly into the grid

  6. Select OK.

The spatial parameter appears at the bottom of the Data pane under the Parameters section.

Visualize your spatial parameter

To visualize the spatial parameter, the parameter needs to be used in a calculation.

  1. Select Analysis > Create Calculated Field.

  2. In the Calculation Editor that opens, name your calculated field.

  3. In the Calculation Editor, drag your parameter and drop it in the formula.

  4. Select OK.

The new calculated field is added to the Data pane. It has an = in front of the data type icon to show it’s a calculated field. You can now visualize your parameter by dropping onto a map layer or double-clicking the pill.

You can change the parameter values by using a parameter control, a parameter action, or a dynamic parameter.

Show a spatial parameter control on the viz

A parameter control is a worksheet card that lets you modify the parameter value. They’re similar to filter cards in that they contain controls that modify the view.

To show the spatial parameter control, right-click (Control-click on Mac) the parameter in the Data pane and select Show Parameter.

Parameter context menu with option to Show Parameter highlighted.

You can use the spatial parameter control in several different ways. As a type-in control, you can type in WKT to set your parameter value, or you can type in ‌the parameter’s alias. You can also use list or dropdown controls to view your spatial parameter.

To learn more about Parameters and how to use them, see Create Parameters.

Spatial operators

Starting in Tableau version 24.3, you can use spatial operators in a calculation.

To learn more about calculated fields and how to use them, see Create a Simple Calculated Field in Tableau.

  1. Create a calculated field using a spatial operator

  2. In a worksheet in Tableau, select Analysis > Create Calculated Field.

  3. In the Calculation Editor that opens, name your calculated field.

  4. In the Calculation Editor, use a spatial operator in the formula.

    For example: UNION([Geometry])

  5. Select OK.

The new calculated field is added to the Data pane with an Equals sign and globe icon to indicate a spatial calcuated field.icon in front of the data type icon to indicate it’s a calculated field used with a spatial operator.

Spatial operators available in Tableau

DIFFERENCE

Operator DIFFERENCE
Definition Computes the portions of regions remaining when all regions in the second argument are carved out of the first argument in areas that overlap. Discards regions from the second argument in areas that don't overlap.
Example

Venn Diagram with only the left side filled and not the middle, next to two geographic areas showing only the difference between the two.

INTERSECTION

Operator INTERSECTION
Definition Computes and returns the portions of regions in the second argument that overlap regions in the first argument.
Example

SYMDIFFERENCE

Operator SYMDIFFERENCE
Definition Computes any portions of regions from the second argument that overlap regions in the first argument and discards from both. Returns the remaining portions of regions from both arguments.
Example

Venn Diagram with middle portion discarded next to a map of two sets of spatial data with overlapping area discardedd.

UNION

Operator UNION
Definition Returns spatial data points, polygons, and lines that overlap or intersect as an outline of the whole.
Example

A map of Washington state with all cities indicated by their own polygon next to an outline of Washington state after the union spatial operator was used in a calculated field.

Thanks for your feedback!Your feedback has been successfully submitted. Thank you!