Tableau has outstanding built-in geocoding capabilities. If you have countries, states, zip codes, congressional districts, statistical areas, etc… in your data then Tableau knows where to plot marks on a map. But there are times when you have data that doesn’t match up with standard geographic locations. There are great tools and techniques out there for generating geocoded data or custom polygons. But over the next few weeks, I’m going to look at various simple techniques that work when you don’t have the time or resources to get too fancy or you simply just need to get the job done.
For example, let’s say you are working with an NGO in Papua New Guinea and want to track shipments of supplies to three different regions in the country. Your data looks like this:
No states or counties, etc… only Regions. And those won’t be recognized as anything geographic. Indeed, Region comes through as a text field and there are no automatically generated Latitude or Longitude fields:
But set the geographic role of the field (right-click Region and select Geographic Role > Area Code). We’ll use area code because there’s no possibility that our regions are valid area codes. Now we see Latitude (generated) and Longitude (generated) as new fields in the data window and double clicking Region gives us a Map!
Of course, Tableau lets us know via an Indicator that three of the area codes are “unknown.” Well, of course they are! But we can fix it… Just click the Indicator and then Edit Locations…
Then, just enter the latitude and longitude for your regions:
It’s a good thing you’ve memorized latitudes and longitudes for various locations in PNG!
Wait… you haven’t?
Oh. Well, you could always use Google Maps (or Bing). Just find a location that represents where you’d like your Region to be, right click and ask Google, “What’s Here?”
And Google will tell you (and give you the latitude and longitude, which you can select and copy/paste)
Repeat that a couple more times, plug the results into Tableau, and you can now plot your data exactly where you want it.
Touch it up with a little transparency, some borders, and notice the dual axis that let me plot text in the center of the circles. And there you have it! A simple technique to get things mapped where you want.
Now, you’ll ask, “What if I have a lot of things to plot and I don’t want to look up all the latitude/longitude values?” or “What if I want to use this in multiple workbooks and I don’t want to have to edit locations each time?”
Great questions… you’ll just have to check back next Tuesday for the next tip…