Use Custom Background Images to Plot Spatial Data

Using Custom Background Images to Plot Spatial Data in Tableau

In many scenarios, you might want to map your data onto a background image instead of on a Tableau map.

Develop Your Skills on the Tableau Training at Mindmajix. Start Learning!

If the spatial data you want to plot isn’t adequately portrayed on a map you can also use image files as backgrounds. This option offers an advantage of infinite flexibility. But, it requires more effort to implement because you will have to define the image boundary coordinates and the point coordinates for the items you want to place on the image.

There are several steps to this process:

  1. Create a table in your data source for X and Y coordinates.
  2. Connect to your data source in Tableau Desktop and join the coordinate table with the rest of your data.
  3. Import your background image and build the view.
  4. Annotate points on the background image.
  5. Add coordinates to the coordinates table in your data source.
  6. Refresh your data source in Tableau.

Why Are Non-Standard Plots Useful?

Analyzing spatial data that’s too small to be meaningful on a map may still yield interesting insight. Alternatively, if you know that your audience won’t have access to the web, you can import a custom map image that contains specific details that are normally available only using online maps or not at all. For example, if you work in a large office and you want to analyze activity within the office, plotting employee movement over time within that space could help you improve the office layout. Retail merchandise managers are interested in tracking how the placement of products on shelves affects sales. Casino managers might be interested in seeing how the placement of cash machines within the casino affects revenue generation in different wagering areas. The options for spatial analysis in Tableau are limited only by your imagination.

MindMajix YouTube Channel

Checkout Tableau Interview Questions

The Steps Required to Build a Custom Spatial Plot

Creating spatial analysis with image files requires additional steps that aren’t needed when using images from web mapping services. This is because the boundary coordinates on a map are based on the longitude (y-axis) and latitude (x-axis) of the map. Image files don’t have the built-in coordinates that are provided by map services. The steps to use an image for a spatial plot are:

  1. Find or create an image file (JPEG or png formats work well).
  2. Trim the image to include only the details you need.
  3. Define the image boundaries (using any metric you desire).
  4. Add point coordinates to your data set.
  5. Tweak point coordinates to precisely position marks on the image.

Assume you want to lay out a small office floor plan for use as a background image to map employee movement within the space. The level of precision you can achieve is dependent on your capture system. Figure 5.18 includes a basic floor plan that will be used to create a custom map background.

Office floor plan image

Figure 5.18: Office floor plan image

You can see that figure 5.18  includes some peripheral areas outside of the floor plan in the image file. These areas are not part of the floor plan. Including areas outside of the floor plan in the image file complicates the image layout later because the dimensions of the office only encompass the office space. For this reason, it makes sense to trim the image to include only the actual floor plan image and not the surrounding white space. The example of floor plan dimensions is (64’-0”x27’-7.5”). It makes sense to define the layout coordinates in inches. This will provide precise placement of marks within each location desired within the office space.

Related Page: How To Monitor Activity On Tableau Server?

Positioning marks on a non-standard map

Positioning the points within images can take a little time. A point coordinate system allowing for at least one position in each room in the floor plan provides the necessary level of detail for this example. Figure 5.19 includes the data set with locations that will need to have point coordinates. The initially estimated point coordinates are in the table given below:

Estimated office point coordinates

Figure 5.19: Estimated office point coordinates

The goal of this visualization will be to place the marks in a way that won’t obscure the place labels that are included in the office layout image. The steps to finish a map of the office plan are:

  1. Connect to a data set that includes the data in figure 5.19.
  2. Disaggregate the measures (so that each individual office location appears).
  3. Add an image of the floor plan from figure 5.18
  4. Edit the (X-Y) point coordinates to precisely position the marks

Learn Tableau Server Tutorial

After connecting to the data set, the (X-Y) coordinates measure values should be placed on the column and row shelves. This will result in a scatter plot view with one mark. Tableau will express the sum of the (XY) coordinate values. The measure needs to be disaggregated to display all of the rows in the data set. This will cause one mark to appear in the view for each location in the floor plan. To do this, de-select the aggregate measure option from the analysis menu. Figure 5.20 shows the view before and after disaggregating the measures.

Connecting to the data

Figure 5.20: Connecting to the data

In the next step, the background image will be added to the floor plan by accessing the maps/background images menu and setting the boundary coordinates for the background image. Figure 5.21 shows the menus used to enter the coordinates and define how the image will be displayed.

Defining the image boundaries

Figure 5.21: Defining the image boundaries

On the left side of figure 5.21, you see the map/background image dialog box. Access this menu from the main map menu/background images’ option. This is where the coordinates for the (X-Y) axis ranges are entered, and the values are defined in inches. Selecting the options menu exposes the menu seen on the right of figure 5.21. The selected options you see on the right of figure 5.21 ensures that the image will not be distorted if its overall size is changed. Clicking  the OK button will add the image to the view seen in figure 5.22.

Initial floor plan image

Figure 5.22: Initial floor plan image

As you can see in figure 5.22, the initial estimates for the mark coordinates are a little off. A good way to reposition marks is to open the source file next to your tableau workbook (it helps if you have a large monitor or dual monitor setup when you do this). With the source file opened next to the visualization, enter revised coordinate values in the source file (save it), then refresh the tableau view by right-clicking on the data source in tableau’s data window. You will see the position of the mark changes. Figure 5.23 shows the final adjusted coordinate layout.

Adjusted point coordinates

Figure 5.23: Adjusted point coordinates

See how precisely each mark is placed. The bathroom marks are right on the toilet seats. It normally requires a few tries to get the marks centered exactly because it’s largely a trail and error process to position marks precisely on image files. Using point annotation on the marks also helps when you perform this task. With an appropriate capture system, the point coordinates data could be provided by a real-time system that captures staff position with time stamps to create the possibility of making an animated view of staff movement. This technique can be used in many different settings.

Explore Tableau Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Publishing workbooks with non-standard geographies

If you use a custom map or image file and share a tableau workbook file (twb) with other people, you must also share the custom source map file (tms) with them or they won’t be able to see the custom map. Alternatively, you can distribute the workbook as a Tableau Packaged Workbook file (twbx). Tableau Packaged workbooks, save all your data and any custom (tms) image files together, thus eliminating the need to provide the (tms) file separately.

List Of Tableau Courses:

 Tableau Advanced
 Tableau Server
 Data Visualization and Dashboarding Fundamentals

 

Job Support Program

Online Work Support for your on-job roles.

jobservice

Our work-support plans provide precise options as per your project tasks. Whether you are a newbie or an experienced professional seeking assistance in completing project tasks, we are here with the following plans to meet your custom needs:

  • Pay Per Hour
  • Pay Per Week
  • Monthly
Learn MoreGet Job Support
Course Schedule
NameDates
Tableau TrainingNov 23 to Dec 08View Details
Tableau TrainingNov 26 to Dec 11View Details
Tableau TrainingNov 30 to Dec 15View Details
Tableau TrainingDec 03 to Dec 18View Details
Last updated: 28 Sep 2024
About Author

As a Senior Writer for Mindmajix, Saikumar has a great understanding of today’s data-driven environment, which includes key aspects such as Business Intelligence and data management. He manages the task of creating great content in the areas of Programming, Microsoft Power BI, Tableau, Oracle BI, Cognos, and Alteryx. Connect with him on LinkedIn and Twitter.

read less
  1. Share:
Tableau Articles