Sample and Demos

Creating a Unique identifier using CRCCalculator

Article Number: 000001412 - Last Modified: Dec 10, 2014

CRCCalculator can be used to create unique IDs based on a natural key or a combination of feature attributes and feature geometry

Description

The CRCCalculator creates a unique ID for a feature based on its geometry and/or attributes. CRC stands for Cyclic Redundancy Check. This is particularly useful if the dataset has a "natural key" -  http://en.wikipedia.org/wiki/Natural_key. Natural keys are created from a list of attribute names and their values for a particular data record or feature. These can be cumbersome to work with in an FME workflow (i.e. FeatureMerger) so combinging the natural key into a single CRC unique ID can simplify the workspace.

Another use case is to use the CRC value for change detection - to make sure it hasn't been changed, corrupted, deleted etc. It can also be used as a form of ChangeDetection (instead of using the ChangeDetector to compare geometry, use the Matcher to compare CRC values).

The value could also be used as a guaranteed unique ID number within a dataset.

Example

The attached workspace(CRCCalculator Example.fmwt) shows an example use of the CRCCalculator transformer.

The CRCCalculator is a great tool for carrying out change detection.

In this example, address records are checked against an updated database using CRC values as identification whether a record has been changed. This workspace generates CRC values on-the-fly; an alternative is to save CRC values for each record, to save having to generate them for each run of the workspace. This is the big advantage of using the CRCCalculator over the ChangeDetector.

 

Workspace Screenshot

User-added image
 

Suggested Similar Articles

Automatically harvest metadata from source MapInfo TAB files and write out one ISO19115 xml metadata document for each input file. This is only meant as a demo and therefore the metadata generated is only partially populated.

This example shows how to generate an xfMap when the schema is embedded in the data such as with: fieldname = 'name', value ='Sophia'.

Create a simple 3D model from extruded 2D CAD data. The results can be displayed in Google Earth after writing them to a KML file.

Here is a basic workflow for producing the minimum requirements for satisfying a given INSPIRE schema for one record. It's also a good starting point if you don't have any sample data and need to generate output from the GML schemas.

Samples using the MapTextLabeller and MapTextStyler transformers to produce aesthetically pleasing cartographic output in FME 2013