KNOWLEDGE BASE

Converting Degrees/Minutes/Seconds Coordinates to Decimal Degrees


Published: 30 Mar 2017
Last Modified Date: 30 Mar 2017

Question

How to convert your longitude and latitude coordinates that are formatted in degrees, minutes, and seconds into decimal degrees in order to help you find the locations on a map.

Environment

Tableau Desktop

Answer

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:

Latitude: 
([Latitude Degrees])+([Latitude Minutes]/60)+([Latitude Seconds]/3600)*
IF [Latitude Direction]="South" THEN -1 ELSE 1
END
 
Longitude:
([Longitude Degrees])+([Longitude Minutes]/60)+([Longitude Seconds]/3600)*
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. 

  1. Select Analysis > Create Calculated Field.
  2. In the Calculated Field dialog box, add the above Latitude formula and click OK.
  3. Select Analysis > Create Calculated Field.
  4. In the Calculated Field dialog box, add the above Longitude formula and click OK.
  5. On the Data pane, right-click (control-click on a Mac) the new Latitude calculated field, and then select Geographic Role > Latitude.
  6. On the Data pane, right-click the new Longitude calculated field, and then select Geographic Role > Longitude.
  7. From the Measures pane, drag the Longitude calculated field to the Columns shelf, and the Latitude calculated field to the Rows shelf.
  8. On the Columns and Rows shelves, right-click the calculated fields, and then select Dimension (if Dimension is not already selected).
  9. 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:

Latitude:
([Latitude Degrees])+([Latitude Minutes]/60)+([Latitude Seconds]/3600)
 
Longitude:
-(([Longitude Degrees])+([Longitude Minutes]/60)+([Longitude Seconds]/3600))

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.

  1. Select Analysis > Create Calculated Field.
  2. In the Calculated Field dialog box, add the above Latitude formula and click OK.
  3. Select Analysis > Create Calculated Field.
  4. In the Calculated Field dialog box, add the above Longitude formula and click OK.
  5. On the Data pane, right-click (control-click on a Mac) the new Latitude calculated field, and then select Geographic Role > Latitude.
  6. On the Data pane, right-click the new Longitude calculated field, and then select Geographic Role > Longitude.
  7. From the Measures pane, drag the Longitude calculated field to the Columns shelf, and the Latitude calculated field to the Rows shelf.
  8. On the Columns and Rows shelves, right-click the calculated fields, and then select Dimension (if Dimension is not already selected).
  9. 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. 
 
Did this article resolve the issue?