KNOWLEDGE BASE

Plotting Geographic Data Using Custom Longitude and Latitude Values


Published: 04 Aug 2014
Last Modified Date: 30 Aug 2023

Question

How to create a map using the longitude and latitude fields from a data source instead of using the built-in geocoding data.

Environment

Tableau Desktop

Answer

  1. Download the attached LongitudeLatitudeTestData.xlsx file, which you will find in the upper right-hand corner of this article under "Attachments". See "Additional Information" section below for notes about how longitude/latitude data needs to be formatted. If the data isn't formatted correctly the option in steps 3 and 4 won't be appear.
  2. In Tableau Desktop, connect to LongitudeLatitudeTestData.xlsx. For more information, see Connect to Data.
  3. In Measures, right-click Ln, and then select Geographic Role > Longitude.
  4. In Measures, right-click Lt, and select Geographic Role > Latitude.
  5. Drag Ln to the Columns shelf.
  6. Drag Lt to the Rows shelf.
  7. Drag Place to Detail on the Marks card.
To view these steps in action, see the video below: 

Additional Information

  • The longitude and latitude must be separate fields in the data source.
  • The longitude and latitude fields in the data source must be numeric data with one decimal place. This is the "Decimal Degrees" (DD) format, but  excluding text characters like ° or N.
  • Converting a value in DD format like 45.7811111° N so that Tableau will recognize it can be done with a calculation like FLOAT( LEFT( [Latitude], LEN( [Latitude] ) - 3 ))
  • If the longitude and latitude data is another format, it may require a more complex calculation to convert. For example, to convert from Degrees Minutes Seconds (DMS) to DD you will need the following formula: DD = degrees + (min/60) + (sec/3600)
  • The example data contains the latitude and longitude values for West Virginia, Virginia, and Maryland. The field and state names are altered so that Tableau Desktop will not automatically recognize them as geographic locations.
Format Geographic Fields in Tableau
Did this article resolve the issue?