-
Notifications
You must be signed in to change notification settings - Fork 21
Mapping with Tableau
Let's go through an example of using Tableau to find some rare Pokemon. This doesn't work for all Pokemon necessarily, but if they spawn in a specific pattern or place, this will help you find them.
In my town, Magmars are hard to track down. As it turns out, that's simply because they almost exclusively show up at a large cathedral downtown. (Perhaps because they look like Satan as some kind of joke? I'd like someone else to help verify!) Here's three days worth of Magmar spottings on a map:
Now contrast that with Pidgeys:
Similarly, while Magikarps show up in random locations, they consistently show up in higher numbers near small streams, and they show up in the same spots along those streams every time:
This same pattern can be found on maps of Psyducks and Staryus.
In the case of Digletts and Tangelas, they only really show up in a large park. The Digletts are scattered through the park, while the Tangelas keep to the Botanical Gardens:
And Exeggcutes keep to their own, separate park:
Now let's get to learning how to do this.
Before you get started with Tableau, you'll have to get Pokelyzer set up. Check out the setup wiki pages for instructions on how to do that.
To begin, you'll need Tableau. If you want to connect it to a PostgreSQL database, it will cost you some money after the trial. (If it's not available during the trial period, let me know and I will write a script to export data from the database to a CSV file.) Or if you're a student, you can get a free license here.
Once you get Tableau installed, install the appropriate drivers for PostgreSQL from their website.
Now with everything set up, we can get started!
Open Tableau and select PostgreSQL from the left sidebar and put in your credentials:
On the next screen, drag the spotted_pokemon
table into the center area first, followed by the date_dimension
, time_dimension
and pokemon_info
tables. The result should look like this:
Now click each of the pairs of circles that connect the tables and choose Left Join for both:
When you're done, click Update Now and wait while the data loads. The table should look like this when you're done:
Since Tableau doesn't have direct support for geospatial data objects, we're going to hide the columns that have that kind of data. Scroll right on the table until you find the Geo Point
and Geo Point Jittered
columns. Hover over their column headers, select the arrow in the top right, and click hide:
Luckily we have separate Latitude and Longitude columns that Tableau can use, so this isn't a big deal.
Next, click "Sheet 1" at the bottom left of the screen to open your first Workbook. Along the left hand hide, you'll see all of the measures and dimensions available to do the analysis. Thing of measures as "stuff we want to count or average" and dimensions as "things we'll use to slice the data up". For example, if you wanted to find the average "Time Until Hidden" of all Pokemon by their name, "Time Until Hidden" would be the measure, and "Name" would be a dimension.
Tableau did it's best to guess which columns of data were measures and which were dimensions, but it doesn't do a perfect job so we'll need to move a couple things. Drag each of the items under the time_dimension in the Measures section up to the Dimensions section:
And do the same for each of Longitude
, Latitude
, Longitude Jittered
and Latitude Jittered
. If you collapse the date_dimension
and time_dimension
menus, the final result should look like this:
OK, now we're good to get started! Let's build the worksheet I used to find the Pokemon clusters above. First drag Longitude Jittered
into the "Columns" area on the workbook, and Latitude Jittered
into the "Rows":
We're using the "jittered" longitude and latitude because a lot of the points are exactly on top of each other. The jittered values have had their locations randomized by a few metres and will make overlapping points easier to see.
Next, we're going to filter out some potentially bad data. I noticed that some of the data points had a "Time Until Hidden" value that was giant negative number. To get rid of those points, drag the Time Until Hidden Ms
measure into the Filters pane, select "All values" and click next:
Then select "At least" and enter 0
in the box and click OK:
Finally, drag the Name
dimension into the Pages pane. Think of Pages as "pages of a book": we want each Pokemon, based on their name, to have a their own page in a book that shows where they're been found. The screen should now look like this:
Using the dropdown or the left and right arrows next to them in the pane below pages, you can now flip through maps of all the Pokemon that have been discovered! Give it a try.
The background map doesn't have a lot of detail, though, so you can't zoom in very far. To fix that, download one of the zipped TMS file from this post over at the Tableau community. Unzip it, and then go to the Map > Background Maps > Map Services..
menu in Tableau, and import the unzipped file. Your workbook now uses OpenStreetMaps as a background instead of the default Tableau map:
\
That's all!
- Getting Started
- Ubuntu Setup
- Windows Setup
- Apple OS X Setup
- Patches and Fixes
- Applying Patches
- Fixing Timezones
- Advanced Configuration
- Multiple Time Zone Support
- Using with Tableau
- Mapping
- Dimensions and Online Hosting
- Using with Microsoft's Power BI
- Basic Charting and Mapping