What is Geocoding?


To display data on a map, the data must either be geocoded or directly contain coordinates such as longitude and latitude. Geocoding in Spotfire means that some identifiers in a data table are used to match against similar identifiers in another set of data tables (a geocoding hierarchy) which contains latitude/longitude coordinates or geographic features. These coordinates or features are then used for correctly positioning the data in a map context. If your data contains simple geographic elements such as country names, states, or similar, then Spotfire will attempt to automatically geocode your data. If no automatic geocoding can be performed, you can set up the geocoding manually instead.

By specifying that a column in a data table should be used to match against a specific geocoding hierarchy you can make the process of setting up a map chart with that data easier.

In this example, the state column is automatically identified as US States and the data is correctly positioned on the map.

Automatic Geocoding and Hierarchies

A geocoding hierarchy is a collection of ordered geocoding tables that can give you the opportunity to drill down to a more detailed level when zooming in on the data. The hierarchy should contain all geocoding tables that the layer should be allowed to choose from when applying geocoding, and it should preferably be a geographic hierarchy with different level of detail, such as:

Spotfire automatically adds (hidden) geocoding data tables if you add a map chart for a data table where geographical names can be found. When selecting the best suited geocoding table, Spotfire checks the expression on the Geocode by/Marker by-axis and chooses the geocoding table to which the geocoding primary key columns can be matched using column matching. If only State is used on the axis, the US States table would be selected, but if both State and County are used on the axis, then the US Counties table is selected.

Once Spotfire has chosen a geocoding table, the visualization downloads and joins in that table in the map chart based on the found column matches.

Manual Geocoding

When you are manually setting up geocoding you must consider which columns in your data can be used to identify the location of the data. For example, this could be a State column or a State/County hierarchy. Note that the level at which you select to display your data is the one that should be used for geocoding, since the Marker by axis and the Geocoding by axis in map charts are the same in marker layers. Hence, if you want to show data for different states you must geocode by state and not by counties.

You can specify the geocoding type and representation for a selected column in your analysis by choosing a suitable Geocoding property or hierarchy under Geocoding in the expanded Data in analysis flyout or in Column Properties.

When using the Geocoding settings in the expanded flyout, you can easily specify that a column contains either longitude or latitude values, geometries, or some hierarchical location.

For the cases where the column names in the data table do not match any of the columns in the available geocoding tables, you can try using the Auto-match button in the visualization properties (or under Hierarchy in the Geocoding settings in the Data in analysis flyout) to match on the content of the column rather than on the column name.

Geocoding Hierarchies in the Library

A set of default geocoding hierarchies are shipped with Spotfire Server as a zip archive which a library administrator can import into the library, as described under Importing to Library. Each hierarchy consists of a number of geocoding tables. Once imported, the geocoding hierarchies are normally located in the GeoAnalytics folder in the library. Because most of these geocoding tables contain geographic shapes they can also be used as feature layers in your map chart. The geocoding hierarchies located in the library will appear in the list when you click Add in the Marker Layer Settings – Positioning dialog and the Feature Layer Settings – Geocoding dialog.

You can also add your own geocoding tables to the library by following the instructions in Setting Up New Geocoding Tables.

Note: If you are using Spotfire Analyst without a server, these geocoding tables are saved locally. For details, see below.

Locally Stored Geocoding Tables

It is possible to add locally stored geocoding tables to an analysis, if, for example, you do not have access to the library. To add a locally stored geocoding table follow these steps:

  1. Open the properties page for the map chart.

  2. Click Layers.

  3. Select the marker or feature layer you want to use the geocoding for and click Settings.

  4. Click Positioning in the Marker Layer Settings or Geocoding in the Feature Layer Settings.

  5. For the Marker Layer, select Geocoding.

  6. Select the column you want to geocode by.

  7. Click Add > Add next to the Geocoding hierarchy list.

  8. In the flyout that is opened, browse to the geocoding table to add, click Open and then OK.

Note: If you are using Spotfire Analyst without a server, you must install the default geocoding tables using a separate installer, as described in the readme file available with your installation kit. After installation, the geocoding tables are by default located in the folder C:\Users\<your user>\AppData\Local\Spotfire\<version number>\Example Data\Geocoding Data\

Geocoding Data Table Properties

The loading of a shapefile or GeoJSON file automatically sets the required properties both on the data table and on the columns in the resulting data table. This means that shapefiles and GeoJSON files can always be used for geocoding both marker and feature layers, provided that the files contain some identification column (such as State name or similar). It is worth noting that a single SHP file (without a DBF file), or a GeoJSON file without 'properties' JSON object, never contain such identification information because all column information is located in the corresponding DBF file for shapefiles, and in the 'properties' JSON object for the GeoJSON file, (except for the geometry column and the numeric columns that are calculated at import, such as XMin, YMax etc.).

There are a number of data table properties applicable to geocoding tables:

Geocoding Column Properties

There are also a number of column properties that should be set on the columns in a geocoding table:

The "geocoding" keyword is automatically added when Exporting Data to Library. This makes it possible to quickly show only geocoding tables by setting the search expression to "keywords:geocoding".

Disabling Automatic Geocoding

A Spotfire Administrator can disable auto-loading of geocoding tables completely for a group of users by setting the AutoloadGeocodingTables preference to False. This preference is found by selectingTools > Administration Manager, go to the Preferences tab, and look in the MapChartPreferences group. This may be desired if the group is on a slow connection or if the system repeatedly makes unwanted geocoding matchings.

See also:

Marker Layer Settings – Positioning

Feature Layer Settings – Geocoding

What is a Map Chart?

How to Use the Map Chart