KNOWLEDGE BASE

## Converting Latitude/Longitude from Degrees/Minutes/Seconds to Decimal Degrees

Product(s): Tableau Desktop
Version(s): All

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 does 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))

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

2. Select Analysis > Create Calculated Field.

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

• In the Name box, enter Latitude Conversion.

• In the formula box, enter the formula below, and then click OK:

([Lat Deg]+([Lat Min]/60)+([Lat Sec]/3600))*
IF [Lat Dir]="South" THEN -1 ELSE 1 END

4. Select Analysis > Create Calculated Field.

5. In the Calculated Field dialog box, do the following tasks:
• In the Name box, enter Longitude Conversion.

• In the formula box, enter the formula below, and then click OK:

([Lon Deg]+([Lon Min]/60)+([Lon Sec]/3600))*
IF [Lon Dir]="West" THEN -1 ELSE 1 END

6. On the Data pane, right-click (control-click on a Mac) Latitude Conversion, and then select Geographic Role > Latitude.

7. On the Data pane, right-click Longitude Conversion, and then select Geographic Role > Longitude.

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

9. On the Columns and Rows shelves, right-click the calculated fields, and then select Dimension (if Dimension is not already selected).

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

Alternate Search Terms:calculations, decimal degrees, latitude, longitude