How to show a map within X meters of X location in Tableau
I’ve been using Tableau since 2017 and Tableau has been updated a lot with awesome features.
Workout Wednesday
Workout Wednesday is the one of the websites that I’m looking to build my skills up in Tableau.
A weekly challenge to re-create a data-driven visualization.
I was looking for a feature to show a map within X meters of X location to apply on the project that I’m currently working on.
And below is the thing that I’ve been exactly looking for so, let me share some features that I’ve learnt from this workout.
#WorkoutWednesday2019
Week 43: Show me all the casinos within X miles of X casino by meters
Features
MakePoint converts data from latitude and longitude columns into spatial objects.
Distance returns distance measurement between two points in a specified unit which are meters, kilometers, miles and feet.
Parameter Action to let your audience change a parameter value through direct interaction with a viz, such as clicking or selecting a mark.
Data
Las Vegas Casino Data from WorldCasinoDirectory. There are only 4 columns.
Column 1 : Name
Column 2: Address
Column 3: Latitude
Column 4: Longitude
You can download this data from link below.
Parameters
We need to create 2 parameters that can be selected by user.
parameter 1 : Select a Casino
Select a Casino is to select a mark on the map and update selected casino.
parameter 2 : Miles Away
Miles Away is to input custom number of miles to show selected casino and all others within mileage.
Calculated Fields
We need to create 7 calculated fields.
Calculated Field 1 : Selected Latitude
Selected Latitude is latitude of the casino which is selected by user.
Calculated Field 2 : Selected Longitude
Selected Longitude is Longitude of the casino which is selected by user.
Calculated Field 3 : MakePoint Start
MakePoint Start is a spatial objects from Selected Latitude and Selected Longitude.
Calculated Field 4 : MakePoint Casinos
MakePoint Casinos is a spatial objects of all other casinos.
Calculated Field 5 : Distance Miles
Distance Miles to return distance measurement between MakePoint Start and MakePoint Casinos in miles.
Calculated Field 6 : Selected Casino
Selected Casino is to highlight and shape a value from Select a Casino.
Calculated Field 7: Miles Filter
Miles Filter is to show only selected casino and all others within mileage.
Parameter Action
After creating a dashboard, the last thing you have to do is to create a parameter action.
Specify the target parameter and a source field which can be a Select a Casino from parameters and name from source fields.
Here is my shot!
You can check my data visualization here more!