Map Viewport Parameters
What is a map viewport?
A map viewport in Tableau is the area of the map that is currently visible. Each instance of a map, whether on a worksheet or a dashboard, has its own viewport. Think of a viewport as a window that can vary in size and shape, allowing you to see different portions of the map. For example, you can view a map zoomed in on a specific region, or you can view it zoomed out to show a larger amount of geography. It's the same map, but the area that you can see is different.
Map viewport zoomed in on a specific region.
Map viewport zoomed out to show a larger amount of geographic information.
By understanding and using dynamic map viewport parameters, you can create more engaging and interactive map visualizations in Tableau.
Why use dynamic map viewport parameters?
You can use dynamic map viewport parameters in Tableau to set a spatial data value parameter to the rectangle that is your map viewport. This parameter updates automatically with every zoom and pan action on the map, not just when the workbook is opened. The viewport will also work when you use the map search functionality. This feature enables you to create more interactive and responsive map visualizations.
Here are some ways you can use dynamic map viewport parameters:
Filter points: Use the Intersects calculation to filter points that intersect with the current map viewport.
Adjust mark sizes: Use the Area calculation to adjust mark sizes based on the size of your viewport.
Create new map polygons: Use spatial operators to compare different map polygons, generating new polygons based on the current viewport.
Visualize the parameter directly: You can visualize the parameter by using it in a calculation to see the current viewport.
Sync multiple maps: Select one map as your viewport and use the viewport to filter the data of the other map. This makes sure that the second map updates based on the area shown in the first map.
In this image, one map is used as the viewport parameter. If you zoom and pan on the NY Subway map, the changes happen to the NY Schools map at the same time.
How do you create a dynamic map viewport parameter?
-
In the Data pane, select the dropdown arrow in the upper right corner and select Create Parameter.
-
In the Create Parameter dialog box, name your parameter.
-
Set the data type to Spatial.
-
Set the Allowable values to All.
Note: List is not compatible with dynamic map viewport parameters
-
Under Dynamic value, expand the Map Viewport menu and select the map that you'd like to use as a viewport.
Tip: If you don't see the map that you'd like to use, go to the worksheet to initialize the viewport. Then, you can reopen the parameter dialog and you will see your map viewport listed.
Avoid setting the parameter value through a control or action. Parameter values change with every zoom and pan on the map. Any value set through controls or actions will be overwritten with the map viewport value.
To learn more about creating parameters and showing a parameter control on a viz, see Create Parameters.
To learn more about spatial parameters and operators, see Spatial Parameters and Operators.