Using Background Images in a Map Chart


Last week we discussed how to use ESRI Shape Files in Map Charts.  This week we will stay with the Map theme, but learn how to use Images as backgrounds inside a Map Chart, instead of ESRI Shape Files. These background images can be useful for a variety of things, not just traditional maps, but also maps of the human body, maps of a wafer chip, etc' We can add this just as a typical background image, but what we really want is to be able to place markers ontop of specific points on the background image, similar to what we can do with a Shape file.   To do this, assuming you do not have coordinates built into your data table, you will need to utilize tags inside Spotfire to map the points in your data to sections on your background image.

 

Assume we have an image of the Boston subway system loaded as a background image in a Map Chart, as shown below.

 

 
And we have a data table which has an entry every time someone uses a ticket at one of the subway stations.


 

 

We will need to map the coordinates of each Station so that we can place the markers ontop of the correct location in the background image.

To do this, we will first need to create a data table with two columns, X, and Y, to act as a data grid. For example, the subway image is rather detailed, so our data grid is 100 x 50.   I wrote a JavaScript file with a couple of loops to output a csv file which I could import into Spotfire for the Data Grid.
 
 
Then we update the Map Chart Properties to use the Data Table we just added (the Data Grid) for markers, and set the Columns used to X and Y as shown in the following image:




 
We also need to click on the 'Position Settings'' button and confirm the position setting based off our data grid, in this case its 100 x 50.
Then, while still in the Map Chart Properties dialog, goto the Shape section and  update the shape definition of the markers to be a the cross shown below. In addition reduce the size of the markers as well.
 

 

 

When you are done, close the Map Chart Properties and you should see something similar to the following:

 

The data grid is overlayed ontop of the subway map.  We will then want to mark records in the data grid over the various subway stations.  In order to do this, we will need to create a new Tag collection and create a new Tag for each Station we want to map.


 


Once this is done, we can  mark records of for each Station, and assign those marked records to the appropriate Tag.
After you have accomplished this for all the stations on the map, filter out the 'untagged' values and export the data table.

Then you can use 'Insert > Columns from External Data' to merge in the X and Y columns from the exported data into the data table containing the popularity of each station.

Finally, go back into the Map Chart Properties dialog, and update the data table used to be the one with the raw data for the popularity of each station. Make sure you use the same position settings as you did with the Data Grid.  The end result is shown below, where you have values marked ontop of the background image in the correct location.
 

 

 

As we mentioned before, this is not limited to traditional maps.
 
 

If you are interested in learning more about Maps or other visualization types in TIBCO Spotfire, please consider taking our Essentials training courses.

Thanks for Christof Gaenzler for the concept behind this tip of the week.