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…
Nice write up Joshua. I’ve used this technique quite a few times. Too bad we can’t right-click Tableau’s maps to get the lat/longs, and avoid Google Maps altogether.
Thanks Shawn! Actually, I just checked in 9.0 (probably works in previous versions), but you can right click the map and select Annotate > Point, and then insert the Latitude and Longitude fields into the annotation. A little cumbersome, but at least it keeps you in the tool and doesn’t break the flow as much.
Hi – sorry for novice question, but how did you actually change the color of label text of the second axis without effecting the color of the actual circle?
Thanks
Disregard – figured it out.
Oh, good!
hi nice write up
i was wondering if you can help me with an option.. I have a file with lat long of NYC and i wanted to create a csv file with the same data but along with the zip codes corresponding to the lat longs. I am able to map it but unable to extract the data (lot lang zip code) as table. can you suggest a way to do it in tableau
?
I’m not sure I follow exactly what you want to do? What kind of file is your original?
This was really helpful! Thanks.
Your welcome! I’m always glad to hear when something helps people!
I have a map of Oregon that I am color coding by county. The indicator has found most of the county outlines but a few remain as small colored dots instead. Do you have a solution for this?
I was wondering how you got the data label inside the circle?
James, So, it looks like what I did there was use a dual axis (notice the duplicated Latitude field on Rows), but I think you could get the same effect by using the alignment property of the Label shelf.
HeyJoshua,
I was wondering if you could help me with one of the tasks i need to accomplish in Tableau 10.0
My data has date, Lat, long, average temperature and number of people who have opened my emails at this level.
i have been asked to group the Lat-Longs in such manner that i have a region, whose max temp and min temp i am aware of and i also know how many of my emails sent have been opened here.
So basically the challenge i am facing is, i am unable to group lats and longs together in Taleau.
If you can help me with the same please send your response to samida.singh@mu-sigma.com
samidha.singh@mu-sigma.com– Correction