1/31/2016
Geo Midpoint in Tableau
Final 12 months I did a number of weblog posts on geo-optimization in Tableau utilizing R. My first weblog put up Dynamic Geo-Optimization in Tableau Using Integration with R with a sample video and an outline of how this may work. The unique R code is from R-Bloggers posted here. In November, Silke Govaert from Datatonic, emailed me. Based mostly on my work, she had carried out this in Tableau and collectively we posted a full tutorial put up here. This technique requires a connection to R. It runs an optimization based mostly on the latitude and longitude of factors taking into consideration some kind of weighting.
This previous week, I had a number of folks ask me about discovering the middle level for a bunch of factors on a map utilizing Tableau with out R. There are a number of strategies for locating a geo midpoint. They’re outlined here. One of many strategies that’s described makes use of the averages of the latitude and longitude. This technique assumes a flat earth. It provides an in depth approximation of factors when they’re inside an in depth distance of one another (ex. 250 miles).
The benefit of utilizing this technique in Tableau is 1.) that is actually quick and a pair of.) it does not require any data or setup of R. The factors on the map will be chosen in the identical method as when utilizing R and the midpoint is recalculated on the fly based mostly on these chosen factors. Under is an instance on Tableau Public or click on here to obtain the Tableau Workbook.
Listed here are the steps to create this visualization.
Step 1: Open Tableau and cargo some information
Required fields are Latitude, Longitude and a few kind of ID/Dimension. For instance, I’m utilizing 3 fields from crime information in Cincinnati that has Latitude, Longitude and Incident No. Obtain an instance information file here
Observe – be sure to take away NULL values out of your information supply, in any other case the middle level will present in several places.
Step 2: Construct Maps
« Factors » Map
Transfer Incident No from Measures (inexperienced capsule) as much as Dimensions (blue capsule)
Transfer Longitude to Columns
Transfer Longitude to Rows
Transfer Incident No to Particulars
Pin Map to the present places
« Heart » Map
Create new Worksheet
Transfer Longitude to Columns
Transfer Longitude to Rows
Transfer Incident No to Particulars
Pin Map to the present places
Take away Incident No
Step 3: Construct Dashboard
Create New Dashboard
Transfer Factors Map onto Dashboard
Transfer Heart Map onto Dashboard
Choose Dashboard -> Actions and create new « Filter Motion »
Choose Factors Map within the Supply Sheet and Heart Map within the Goal Sheet
Click on « OK »
Click on « Add Motion » and choose « URL »
Choose « Heart » map within the Supply Sheet
Enter this Google Maps URL within the URL field:
https://www.google.com/maps/place/<AVG(Latitude)>+<AVG(Longitude)>/@<AVG(Latitude)>,<AVG(Longitude)>,17z/
Format as desired
On « Heart » map, drag Latitude and Longitude to the Labels
Change colour of dots and dimension as desired
It’s best to now have a dashboard with two maps, one with all of the factors and the opposite with the middle of these factors based mostly on the latitude and longitude of all the factors. Use the « Choose A » keyboard shortcut on the « Factors » map and choose no matter factors you want. The « Heart » map will recalculate based mostly on the factors chosen. For those who click on on the middle level on the middle map, it is going to hyperlink on to a Google Maps web page utilizing the latitude and longitude to be able to view the middle level on Google Maps.
I hope you discover this data helpful. In case you have any questions be at liberty to electronic mail me at Jeff@DataPlusScience.com
Jeffrey A. Shaffer
Observe on Twitter @HighVizAbility