Adding Location Capabilities to a Map Visualization


If your data has latitude and longitude columns, you can create a visualization that a mobile iOS device user can access to determine the distance from a location. Just add reserved document properties and a calculated column for distance calculation, and then share your visualization with mobile users. The document properties activate the location icon in the iOS device. The following example demonstrates how to create such a visualization and test it.

  1. Open a file containing the data with latitude and longitude columns.

    Comment: Check the Import Settings  to make sure the column names and data types are correct.

  2. Using Recommended Visualizations, select the latitude  and longitude for your axes.

    Response: The first recommendation is a Map Chart.

  3. Select the recommended Map Chart, and then close the Recommended Visualizations dialog.

    Comment: You can apply any Color by settings, map layers, or filters at any time.

  4. On the menu, click Edit > Document Properties, and in the Document Properties dialog, click the Properties tab.

  5. Click New, and in the resulting dialog, provide the reserved name AppGeoLatitude.

  6. Set the Data Type to Real, and the Default Value to 0.0 (the equator).

  7. Comment: For testing purposes, you can set AppGeoLatitude to  your latitude, but before saving the final version, set it to 0.0.

  8. Add another document property, providing the reserved name AppGeoLongitude, setting the Data Type to Real and setting the Default Value to 0 (the prime meridian).

  9. Comment: For testing purposes, you can set AppGeoLongitude to your longitude, but before saving the final version, set it to 0.0.

Your visualization now has the document properties required to activate the location icon on an iOS device that can open it from either the Spotfire Cloud or Spotfire Consumer.

  1. On the menu, click Insert > Calculated Column.

  2. Click Insert Columns.

  3. In the Expression box, build the following expression:
    6371 * GreatCircleDistance(${AppGeoLongitude}, ${AppGeoLatitude}, [latitude], [longitude])

  4. Comment: This calculation specifies kilometers. To specify miles, use 3959.

    Comment: latitude and longitude in this example reflect column names. If yours differ, modify the example.

  5. Give the column a name, such as distance, and click OK to save and close the dialog.

  6. Response: The calculated column appears in the Data panel.

Your visualization now has a column that you can use to measure distances between the iOS device and any data point in the data set by using its geo-positioning properties.

  1. On the menu, click Insert > Text Area.

  2. Right-click the new text area, and then click Properties.

  3. In the dialog, provide a title, such as Your Location. Close the dialog to save the change.

  4. Click the Edit icon to edit the text area, and insert two dynamic items, one for the document property AppGeoLatitude and one for AppGeoLongitude, and provide text labels. Save the changes.

  5. Resize the text area to contain just these two controls and the title.

  6. Right-click the map visualization, and from the menu, select Create Details Visualization.

  7. Right-click the visualization, and then click Properties.

  8. Provide a name for the visualization, such as Distance from Your Location. Close the dialog to save the change.

  9. Test the visualization by selecting a data point or a range of data points on the map.

  10. Response: The Details Visualization shows the selected data rows, with the calculated column reflecting the distance from the latitude and longitude shown in Your Location.

  11. Save the visualization and share with your mobile users.

This image shows a visualization containing zip code data for the US. Each zip code has a location specified by latitude and longitude.  In the visualization, you can see the distance from the current location (marked on the map with a red triangle) to the marked data point for the town of Tahuya, the small blue dot (the red arrow points out the dot, added for clarity only).

mobile_adding_positioning.png

See also:

Location

Finding Your Location

Designing TIBCO Spotfire® Analytics for Small-Screen Display.