Geocoders and geocoding
The terms geocoder and geocoding are used in several contexts. This discussion sorts out these contexts, so that the terms' meanings can be clear each time you come across the terms. The discussion defines geocoder and geocoding, describes the modes in which a geocoder operates, describes a larger activity to which geocoding belongs, and summarizes users' tasks that pertain to geocoding.
In Db2® Spatial Extender, a geocoder is a scalar function that translates existing data (the function's input) into data that you can understand in spatial terms (the function's output). Typically, the existing data is relational data that describes or names a location. Db2 Spatial Extender can support vendor-supplied and user-supplied geocoders.
One vendor-supplied geocoder might translate addresses into coordinates that Db2 does not store, but rather writes to a file. Another might be able to translate the number of an office in a commercial building into coordinates that define office's location in the building, or to translate the identifier of a shelf in a warehouse into coordinates that define the shelf's location in the warehouse.
In other cases, the existing data that a geocoder translates might be spatial data. For example, a user-supplied geocoder might translate X and Y coordinates into data that conforms to one of Db2 Spatial Extender's data types.
In Db2 Spatial Extender, geocoding is simply the operation in which a geocoder translates its input into output-translating addresses into coordinates, for example.
Modes
- In batch mode, a geocoder attempts, in a single operation, to translate all its input from a single table (or, alternatively, all addresses in a specified subset of rows in the table).
- In automatic mode, a geocoder translates data as soon as it is inserted or updated in a table. The geocoder is activated by INSERT and UPDATE triggers that are defined on the table.
Geocoding processes
Geocoding is one of several operations by which the contents of a spatial column in a Db2 table are derived from other data. This discussion refers to these operations collectively as a geocoding process. Geocoding processes can vary from geocoder to geocoder. A geocoder may search files of known addresses to determine whether each address it receives as input matches a known address to a given degree. Because the known addresses are like reference material that people look up when they do research, these addresses are collectively called reference data. Other geocoders might not need reference data; they might verify their input in other ways.
The user's tasks
- Prescribing how certain parts of the geocoding process should be executed for a given spatial column; for example, setting the minimum degree to which street names in input records and street names in reference data should match; setting the minimum degree to which addresses in input records and addresses in reference data should match; and determining how many records should be processed before each commit. This task can be referred to as setting up geocoding or setting up geocoding operations.
- Specifying that data should be automatically geocoded each time that it is added to, or updated in, a table. When automatic geocoding occurs, the instructions that the user specified when he or she set up geocoding operations will take effect (except for the instructions involving commits; they apply only to batch geocoding). This task is referred to as setting up a geocoder to run automatically.
- Running a geocoder in batch mode. If the user has set up geocoding operations already, his or her instructions will remain in effect during each batch session, unless the user overrides them. If the user has not set up geocoding operations before a given session, the user can specify that they should take effect set them up for that particular session. This task can be referred to as running a geocoder in batch mode and running geocoding in batch mode.