Reputation: 167
I am trying to make a flight path between origin and destination. I changed the geographic role of origin to Airport. Tableau automatically generated latitude and longitude for the origin airport. Now, I want to store these values into one calculated field or save them individually back to the dataset. How to do it?
For the calculated field part it shows:
operations on the field [Latitude (generated) ] is not permitted.
How to save the latitude and longitude of the origin and dest airport?
Upvotes: 2
Views: 917
Reputation: 141
Starting with a blank sheet, double-click your Origin dimension. Tableau will create a map with all the origin points added to the map as well as adding the generated latitude and longitude to rows and columns.
Right-click on the map and click View Data. In the data window, click Export All and save to CSV.
Open the CSV in Excel, duplicate the origin, origin lat, and origin long columns and rename them replacing the word 'Origin' with 'Destination'. You should have six total columns: origin, origin lat, origin long, destination, destination lat, and destination long.
Select the three origin columns and sort them A to Z so the origins are different from the destinations.
Add the CSV as a data source in your workbook.
Create a calculated field as below and name it Flight Paths.
MAKELINE(MAKEPOINT([Origin Lat],[Origin Long]),MAKEPOINT([Destination Lat],[Destination Long]))
Double-click the Flight Paths dimension to generate a map viz with all the flight paths.
Add Origin and/or Destination to filters to show only the paths you care about.
Ultimately, you will need to edit the CSV to contain the origin : destination pairings you want.
Reference: Tableau Help page on using MakeLine.
Upvotes: 1
Reputation: 2724
You can use latitude and longitude generated in a table following this simple hack.
Just grab the latitude
pills to the Marks Shelf (as Text). Now go to the pills into the Marks Shelf and edit like the following:
<Latitude (generated)>
Same deal with longitude that has to be defined as
<Longitude (generated)>
You can get another description of these steps here.
By the way, you can save the output as CSV and use it in your future application. Is This way ok for you or did you mean to save it into a DB table?
Upvotes: 2