Answer
Step 1 - Ensure your data is prepared adequately
In this example, the data source needs to contain both Longitude and Latitude fields for both the origins and the destinations. In other words the data source must contain two longitude fields (one for destination, and one for origin), and two latitude fields (one for destination, and one for origin).
If your data does not contain such information, download a masterfile data set of airports location (some sites like
transtats.bts.gov
or
openflights.org
have data sources that contain such data and are available for download). Then, using Tableau Prep, add the new Airport location masterfile to your data source flow twice. Adding it twice will join the data and provide both latitude and longitude fields. For help on how to add joins in Tableau Prep, see
Join your data
in Tableau Help.
After exporting this flow, connect to it via Tableau Desktop.
Step 2 - Build the view
-
Create three
calculated fields
to build your map:
-
A Makepoint Destination Field to map the destination point on a map:
MAKEPOINT([Destination LATITUDE],[Destination LONGITUDE])
-
A Makepoint Origin Field to map the origin point on a map:
MAKEPOINT([Origin LATITUDE],[Origin LONGITUDE])
-
A Makeline field to create a line between two points on a map:
MAKELINE([MAKEPOINT_Origin],[MAKEPOINT_Destination])
-
Drag the new Makeline calculation onto
Detail
to view the map
-
(Optional) Change the Line color and Map layers as desired
To view Step 2 in action, see the video below.
Note:
the video has no sound. To view the video in higher quality, click the YouTube icon below to watch it on YouTube directly.
Additional Information
For additional details about how to create Paths on Maps, or line tracing using coordinates, see the following documentation and examples:
-
Advanced
Mapping Solutions
on the Tableau website
-
Create Maps that Show Paths Between Origins and Destinations in Tableau
in Tableau Help
-
The Batman Logo Evolution
on Tableau Public (Note that the Batman logos are built by points in the X and Y axis. It is possible to virtually draw anything this way using Tableau by then generating a line to connect the dots)
-
Using the
Paris Metro example
, the points need to already be in the database (each point should have a path ID so that Tableau Desktop can order them). Additionally, each point should have latitude and longitude data so that Tableau Desktop can plot them.