Files
Introduction
Spider Diagrams, also known as Spider Maps, are a great way to visualize lots of data that relates to a single point. In this exercise, we will be looking at the distance between businesses and their closest rapid transit station in the downtown core. We will clean up data that has extra attributes we aren't interested in and then relate the two datasets and write it out to Tableau format. Finally, we will open our final dataset in Tableau and style it to create a Spider Diagram to share with our colleagues.
Step-by-Step Instructions
1. Open a blank workspace and add a CSV reader
As of FME 2025.2, the Coordinate System parameter is now configured within the Parameters dialog of each reader/writer format. For more information, including details about the change and affected transformers, please see Coordinate System Parameter Location Change.
-
In a new workspace, click the Add Reader icon in the Toolbar and add a reader with the following parameters:
Format: CSV (Comma Separated Value)
Dataset: /business_licenses.csv
Click the Parameters button to set the coordinate system:
Attribute Definition: Manual
Name Type Longitude x_coordinate Latitude y_coordinate Create Point Geometry from Attributes: Enabled
Coordinate System: LL84
Click OK to add the reader to the workspace.
-
In a new workspace, click the Add Reader icon in the Toolbar and add a reader with the following parameters:
Format: CSV (Comma Separated Value)
Dataset: /business_licenses.csv
Coordinate System: LL84
Click the Parameters button and confirm that the Longitude and Latitude attributes are set to x_coordinate and y_coordinate, respectively. If they are not, change the Attribute Definition to Manual, then manually set.
Click OK to add the reader to the workspace.
2. Inspect the Data
Open up the business_licenses.csv in Data Preview (formerly Visual Preview) by partially running the workspace and inspecting the data cache (formerly feature cache). We are only interested in businesses in the downtown core, so we need to determine which attribute we can filter by. It looks like we have an attribute called LocalArea that might contain the data we are looking for. Click a point in the middle of the dense cluster near the top of the map; this is the downtown area. Looking at LocalArea, it has a value of 02-Central Business/Downtown. This is what we will filter by.
3. Add a Tester to Filter by Downtown
Back in the workspace, add a Tester transformer to our CSV file. In the Tester, enter: LocalArea contains Downtown and then click ok.
4. Remove Unnecessary Attributes
The business_licenses.csv file contains a lot of data we don't need for our spider diagram, so we should tidy up the dataset before we continue. Add an AttributeKeeper to the Passed Output port on the Tester. Open the parameters and, under Attributes to Keep, check only BusinessName, BusinessTradeName, BusinessType, and BusinessSubType, then click OK. We don't need to keep LocalArea because we've already filtered what we needed from it. Click ok.
5. Filter Out Rows Without a Latitude and Longitude
The CSV is almost tidy; we just need to do one more thing. Add a GeometryFilter to filter out any rows that don't contain any latitude or longitude values. Set the Geometries Types to Filter to Point.
6. Inspect the Data
Run the workspace partially by selecting the GeometryFilter and clicking the Run button. Then, inspect the data cache on the Point Output port of the GeometryFilter. In the Visual Preview window, confirm that there are only points in the downtown area, that there are only 4 attributes starting with "Business", and that all values have a point on the map.
7. Create a Unique ID
For the spider diagram to be compatible with Tableau, the points data requires a unique identifier. Add a UUIDGenerator and connect it to the Point Output port on the GeometryFilter.
8. Add a KML Reader
Add a reader, enter the following:
| Reader Format: | Google KML |
| Reader Dataset: | ...\rapid_transit_stations.kmz |
Click ok When the Select Feature Type dialog appears, deselect everything except for Rapid Transit Stations.
9. Change STATION to StationName
To keep with our camelcase naming style, add another AttributeManager to Rapid Transit Stations. Change the input name of STATION to the output of StationName.
10. VoronoiDiagrammer
We want to connect each business to the closest transit station. We could do this using something like a Bufferer transformer, but let's take a look at the VoronoiDiagrammer. The VoronoiDiagrammer creates a set of polygons that show the area closest to a given input point.
Add the VoronoiDiagrammer and connect the Points Input port to the Output port on the AttributeManager connected to the Rapid Transit Stations. Then attach an Inspector to the VoronoiPolygons Output port.
11. Inspect the Data
Inspecting the data, we can see that the VoronoiDiagrammer worked and created the polygons, but it removed our Rapid Transit Stations points.
12. Add a CoordinateExtractor
We would like to retain the original point data for our Rapid Transit Stations, so let's add a CoordinateExtractor between the AttributeManager and the VoronoiDiagrammer. The CoordinateExtractor will store the latitude and longitude in an attribute. Open up the parameters and change the Mode to Specify Coordinate. Then change the X Attribute to trainStation_xcoord and the Y Attribute to trainStation_ycoord. Remove the Z Attribute, then click OK.
13. Relate the Two Datasets
Time to relate the two datasets, add the PointOnAreaOverlayer, connect the UUIDGenerator to the Points Input port, and the VoronoiDiagrammer Voronoi Polygons Output port to the Areas Input port.
14. Determine Which Points Overlap With the Areas
Add another Tester and connect it to the Point Output port on the PointOnAreaOverlayer. Set the Tester to _overlaps > 0 to test to see which of the points overlap with the polygons.
15. Create a Spider Diagram
Now that we have processed our data, let's turn it into a spider diagram. Add a VertexCreator and connect it to the Passed Output port on the Tester. Open up the parameters and set Mode to Add Point. Set the X Value to trainStation_xcoord and the Y Value to trainStation_ycoord. This will create a line that starts at the business point location and ends at the transit station. This is done by using the latitude and longitude attributes we created with the CoordinateExtractor.
16. Determine the Distance Between the Business and the Nearest Train Station
To find the distance (as the crow flies) between the business and the nearest train station, we need to measure the length of the lines. Add a LengthCalculator, open its parameters, and set the Multiplier to 100; this will give us the approximate distance in kilometers. Connect this to the Output port on the VertexCreator. Connect an Inspector to the LengthCalculator's Output port to verify that the translation worked before writing it to Tableau.
17. Write to Tableau
Add a Tableau writer and write it to your Output folder. Change the Add Feature Type(s) to Automatic... then click ok. When the Feature Type dialog box opens, change the Table Name to SpiderDiagram and change the Geometry to hyper_line. Run the translation and view the results in Tableau.
18. Create the Spider Diagram in Tableau
To create the spider diagram within Tableau, we need to add the spatial_latitude and spatial_longitude to the shelf. Add both the _uuid and spatial_geometry_order to Detail and then change the Mark Type to Line to see the results. Finally, customize and style your map as desired.