Loading

Plotting Two Sets of Latitude and Longitude on a Map

Дата публикации: Apr 13, 2024
Задача
How to plot two sets of latitude and longitude coordinates. 

NOTE: The sets of latitude and longitude data need to be in different tables in the same data source.
Действия

Open a workbook and connect to data

  1. Compare the structures from the two data sources to determine any differences in the field names and types.
  2. Open Tableau Desktop and connect to the data source.
  3. Select New Custom SQL.
  4. Write a UNION query that creates a common set of fields between the two data tables, such as in the following example:

    SELECT [MapPoints1$].[Location_Name] AS [Location_Name],
    [MapPoints1$].[Latitude] AS [Latitude],
    [MapPoints1$].[Longitude] AS [Longitude],
    [MapPoints1$].[Type] AS [Type],
    "A" as [Source]
    FROM [MapPoints1$]
    UNION
    SELECT
    [MapPoints2$].[Location_Place] AS [Location_Name],
    [MapPoints2$].[Latitude] AS [Latitude],
    [MapPoints2$].[Longitude] AS [Longitude],
    [MapPoints2$].[TypeOfPlace] AS [Type],
    "B" as [Source]
    FROM [MapPoints2$]

  5. Click OK.
  6. In the Data Connection dialog box, select Connect live or Import all data.

Create the map view

  1. Drag [Longitude] (not [Longitude (generated])] to the Columns shelf.
  2. Drag [Latitude] (not [Latitude (generated)]) to the Rows shelf.
  3. Drag [Location_Name] to Label on the Marks card.
  4. Drag [Type] to Color.
Дополнительные ресурсы
The field [Source] may be used to differentiate between the two original data tables in the data connection. 
Номер статьи базы знаний

001458124

 
Загрузка
Salesforce Help | Article