TIBCO Spotfire: A comprehensive primer
Insights - Chapter 7: What's your location?

Following requests from readers, I've decided to go through the examples in Chapter 7 in more detail, demystifying further I hope the concept of geocoding and providing additional screenshots to support the examples in the book.

Geocoding: North American Provinces
provincesTable.png
Geocoding is a very simple concept. It is a way of looking up a table to get some geographical mapping context for a geographically relevant descriptor. For example, if you have a series of US state names in a data set and want to identify where those states are on a map, you need a reference table that gives you their longitude and lattitude. A geocoding table may also provide further classification details, such as region, country, and province. It may provide a "shape file," which is an embedded vector that mapping software, such as TIBCO Spotfire, can use to outline the shape of the geographical entity in question.

Take the North American Provinces geocoding table provided by Spotfire. As you can see from the extract above, it is simply a collection of variables (not all are included in the screenshot) that you can use to plot the location of North American provinces on a map. For example, Minnesota is centered on longitude -93.36 and lattitude 46.43. The geometry column provides a vector shape for the state.

When we talk about geocoding hierarchies, we mean sets of geocoding tables providing different levels of focus, such as North American provinces —> US counties —> US towns and cities. A useful set of geocoding hierarchies ships with TIBCO Spotfire, and they can be used automatically if they are loaded into the library or they can be loaded manually if you have copies. I have provided two of these files for download as zip files. You need to extract the contents, which you should find as "sbdf" files (a proprietary Spotfire binary format that preserves the geometry column as a binary column). In the next section, we'll see how to use these (or any other geocoding) files manually.
Adding a geocoding data file
c7AddGeocodingFile1.png
1. If the geocoding Auto-match button is greyed out or you just want to use an alternative geocoding file, click on the Add button next to Geocoding hierarchy and select Add Data Tables. This will bring you into the, I hope familiar, dialogue for adding data tables (refer to Chapter 1: Show me the data). Add the geocoding data file just like you would do any other data file. One thing to note is that if you have already loaded the geocoding data file using the add data table dialogue outside the context of the map chart, you will still have to add it here again, from either the external or internal source (From Current Analysis). This is an unnecessary duplication in my opinion, but that's the way it works.
Column matching on the loaded file
c7AddGeocodingFile2.pngc7AddGeocodingFile3.pngc7AddGeocodingFile4.png
2. You now have to match the principal column in your data table (STATE in our case) with the relevant column in the geocoding table so that Spotfire understands which attribute you are trying to map and can apply the relevant longitude and latitude in the file. Click on the Edit Column Matches button, click New to define a new match, and simply select the relevant columns in the two tables ([North American Provinces].[Province] and [stationInventory].[STATE]). Click OK twice to complete the mapping. When you are finished, you should see an entry in the Columns matched in this visualization box. If you don't, check that you have matched the table listed in the geocoding hierarchy box and not some other table you have loaded into the analysis file.
Coordinate Columns: Station Inventory file
StationInventory.png
c7AddCoordinateColumns.png
The StationInventory file has longitude and latitude coordinates at a station level, so if you want to plot the location of each individual station, you don't need any other geocoding table. The geocoding is already provided in the data table at a level of granularity far finer than any external geocoding table you could find. In such cases, rather than choosing the Geocoding options, you should choose the Coordinate columns options and simply designate the columns in your data that specify the longitude (X-Column) and latitude (Y-Column) coordinates of the relevant element, which in our case is the station. The station should also be chosen as the Marker By column.
More to come …
More to come on layer properties and feature layers.