This short blog will describe how you can add a link to your Tableau tooltips that, when clicked, will open a new browser tab and open Google Maps at the location specified by the latitude and longitude values of the mark for the tooltip that was clicked on.
To keep this brief, I’ll assume you are familiar with Tableau dashboard actions. If this is not the case, please read this Tableau help page for background information.
For this technique to work, you need to have Latitude and Longitude values in your data as they will be used in the URL that is passed to Google Maps.
Create a URL Calculation
Create the following calculation:
Below is the code to copy:
"https://www.google.com/maps/search/?api=1&query=" + STR([Latitude]) +","+ STR([Longitude])
Add the URL Calculation to the View
For the URL calculation to be available for the URL action, it must first be added to the view, so add the calculated field to the Detail shelf
Create URL Dashboard Action
Finally, we can create the URL action, which will show the link in the tooltip. On the dashboard, go to Dashboard > Actions and the click the Add Action button and select Go to URL…
Set the action up as shown below.
To add the Google Maps URL field to the action, click the right arrow button to the right of the URL field and select the calculation from the list of fields.
The Name of the action is the text that will appear in the tooltip, so you want this to be descriptive and tell the consumer what will happen when they click the link.
You may have noticed I have a link symbol at the start of the Name. This is a unicode symbol: 🔗 which you can copy and paste in.
The screenshots above we taken from a map visualisation I created for the #30DayMapChallenge. You can explore and download the workbook from Tableau Public here.
Thanks for reading!
Latest YouTube video
This video tutorial steps through how to create a dot plot in Tableau.
Leave a Reply