Last Modified Date: 24 Oct 2022
Environment
Tableau DesktopAnswer
To convert the values in Tableau directly, you can use calculated fields. For Tableau to do the conversion, however, the data must be in the form of degrees, minutes, and seconds in separate fields. There are two types of formulas that you can use, both are detailed in the attached workbook.
Option 1 - Your Geographic data does not contain negative numbers
In a calculated field, you can use a similar set of formula to convert your data into decimal degrees:
IF [Latitude Direction]="South" THEN -1 ELSE 1
END
IF [Longitude Direction]="West" THEN -1 ELSE 1
END
In the below example, we'll convert the values for a few cities in India. In general, India's decimal degrees are positive: Latitude: 20.59°N and Longitude: 78.96°E.
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box, add the above Latitude formula and click OK.
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box, add the above Longitude formula and click OK.
- On the Data pane, right-click (control-click on a Mac) the new Latitude calculated field, and then select Geographic Role > Latitude.
- On the Data pane, right-click the new Longitude calculated field, and then select Geographic Role > Longitude.
- From the Measures pane, drag the Longitude calculated field to the Columns shelf, and the Latitude calculated field to the Rows shelf.
- On the Columns and Rows shelves, right-click the calculated fields, and then select Dimension (if Dimension is not already selected).
- From the Dimensions pane, drag the City field to Label.
Option 2 - Your Geographic data does contain negative numbers
In a calculated field, you can use a similar set of formula to convert your data into decimal degrees:
In the below example, we'll convert the values for a few cities in Ireland. In general, Ireland contains negative decimal degrees : Latitude: 53.14° N and Longitude: -7.69° E.
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box, add the above Latitude formula and click OK.
- Select Analysis > Create Calculated Field.
- In the Calculated Field dialog box, add the above Longitude formula and click OK.
- On the Data pane, right-click (control-click on a Mac) the new Latitude calculated field, and then select Geographic Role > Latitude.
- On the Data pane, right-click the new Longitude calculated field, and then select Geographic Role > Longitude.
- From the Measures pane, drag the Longitude calculated field to the Columns shelf, and the Latitude calculated field to the Rows shelf.
- On the Columns and Rows shelves, right-click the calculated fields, and then select Dimension (if Dimension is not already selected).
- From the Dimensions pane, drag the City field to Label
Additional Information
To view the above options in action, see the video below:Note: the video has no sound.