Knowledge Base

Linking to Google Maps

Product(s): Tableau Desktop
Version(s): All
Last Modified Date: 22 Aug 2014

Article Note: This article is no longer actively maintained by Tableau. We continue to make it available because the information is still valuable, but some steps may vary due to product changes.


You can use Tableau to link to Google Maps through the Tableau API. There are two methods for doing this. The first is to use Google's URL mapping and connect using an action. The second is to use Google's mapping code.

Create a link to maps.google.com using a Tableau action

In this method, you copy the URL of a Google Map, and then use that information as a starting place to create a Tableau URL action. For example, if you want to link by zip code to a Google Map:

Step 1

Search for a zip code to get a generic Google Maps URL. The link looks like this:

http://maps.google.com/maps?f=q&q=98043

Step 2

Build the view you want using Tableau. Make sure to include the Zip Code field on either the Rows shelf or the Columns shelf.

Step 3

For Tableau Desktop 7.0 and later, select Worksheet > Actions.

For Tableau Desktop 6.1 and earlier, select Edit > Actions.

Step 4

In the Actions dialog box, click Add Action and select URL.

Step 5

In the Edit URL Action dialog box, click the right arrow next to the Name text box, and select Zip Code.

Step 6

Under Run action on, select Menu.

Step 7

In the URL text box, paste the Google Maps URL.

Step 8

Click Test Link.

Step 9

If the link successfully connects to a Google map, it is working correctly. Click OK in both dialog boxes.

Experiment with the various URL parameter options available with Google Maps.

Create a link to a web page that you have designed

Creating this link embeds a Google Map image in your Web page by means of the Google Maps API.

Why would you use this method?

You may have noticed when using option 1 above that Google Maps always requires you to minimize the left navigation panel. On a Tableau dashboard, this requirement wastes precious screen real estate. A way around this limitation is to link to a Web page that uses the Google API. The hard part about linking in this manner is that you need to:

  • Study the Google Maps API
  • Test your Web page thoroughly before publishing
  • Make a note not to contact Tableau Support about using the Google Maps API (Thanks in advance)

This article provides an example Web page that you can create.

Note: Designing these types of solutions is outside the scope of Tableau Support. If you require more assistance, please contact our sales team so that we can provide professional services to assist you.

Some brief notes about the HTML and JavaScript provided in this article:

  • The function "gup" is a regex (regular expression) function that strips out "lat" and "long" from your URL action. You need to provide these fields in your data. (You can also figure out how to use Google API with things like zip, city, street, etc.)
  • The function "initialize" takes the latitude and longitude, inserts them in the variables "urlLat" and "urlLong," and then invokes the actual Google API.
  • The HTML is set to load the JavaScript on page load.
  • In theory, you would place a Web page in your Tableau dashboard (although this placement is not required). An example screenshot of this action is shown later in this article.
  • You need to place this HTML file somewhere where Tableau Desktop (or Tableau Server) can find it. It can be on your hard drive, a network location, or a Web server.

 

Alternate Search Terms: actions, google, maps, api
Did this article resolve the issue?

Attachments

Search Knowledge Base