Knowledge Base

Converting Lat/Lon from Degrees/Minutes/Seconds to Decimal Degrees

Product(s): Tableau Desktop
Version(s): 7.0, 8.0, 8.1
Last Modified Date: 19 Jun 2014

Article Note: This article is no longer actively maintained by Tableau. We continue to make it available because the information is still valuable, but some steps may vary due to product changes.


Tableau needs latitude and longitude values to be in decimal degrees. If your data is in degrees, minutes, and seconds, you need to convert these values to decimal degrees before Tableau can find the locations on a map.

You can convert the values outside of Tableau, or you can use calculated fields to convert the values directly in Tableau. For Tableau to do the conversion, however, the data must be in the form of degrees, minutes, and seconds in separate fields.

General formulas to use to convert to decimal degrees
In a calculated field, you can use one of the following sets of formulas to convert your data into decimal degrees.

  • If your data (degrees/minutes/seconds coordinates) contains geographic locations and do not contain negative numbers? Use this set of formulas:
Latitude: 
([LATITUDE_DEG])+([LATITUDE_MIN]/60)+([LATITUDE_SEC]/3600))*
IF [Latitude_Direction]="South" THEN -1 ELSE 1 END
 
Longitude:
([LONGITUDE_DEG]+([LONGITUDE_MIN]/60)+([LONGITUDE_SEC]/3600))*
IF [Longitude_Direction]="West" THEN -1 ELSE 1 END
  • If your data (degrees/minutes/seconds coordinates) does not contain geographic locations and contains negative numbers? Use this set of formulas:
Latitude:
[LATITUDE_DEG])+([LATITUDE_MIN]/60)+([LATITUDE_SEC]/3600)
 
Longitude:
-(([LONGITUDE_DEG])+([LONGITUDE_MIN]/60)+([LONGITUDE_SEC]/3600))

The example uses the second set of formulas.

Step 1

In Tableau, connect to the data source that has the latitude and longitude in degrees, minutes, and seconds.

Step 2

Select Analysis > Create Calculated Field.

Step 3

In the Calculated Field dialog box, do the following tasks:

  1. In the Name text box, type Latitude Conversion.
  2. In the Formula text box, type the formula below, and then click OK.
([Lat Deg]+([Lat Min]/60)+([Lat Sec]/3600))*
IF [Lat Dir]="South" THEN -1 ELSE 1 END

Step 4

Select Analysis > Create Calculated Field.

Step 5

In the Calculated Field dialog box, do the following tasks:

  1. In the Name text box, type Longitude Conversion.
  2. In the Formula text box, type the formula below, and then click OK.
([Lon Deg]+([Lon Min]/60)+([Lon Sec]/3600))*
IF [Lon Dir]="West" THEN -1 ELSE 1 END


Step 6

From the Measures pane, drag the Longitude Conversion field to the Columns shelf, and the Latitude Conversion field to the Rows shelf.

Step 7

On the Columns and Rows shelves, right-click the calculated fields and select Dimension.

Step 8

From the Dimensions pane, drag the City field to Label.

Alternate Search Terms:calculations, decimal degrees, latitude, longitude
Did this article resolve the issue?

Attachments

Search Knowledge Base