StatisticsCalculator Example

From Fmepedia


The attached workspace provides an example workspace showing how the StatisticsCalculator transformer might be used - in particular the Group-By function on the transformer, which is new for FME2008.


Table of contents

Scenario

The simple scenario here is to find the average annual expenditure on toothpaste for each postal code in the City of Interopolis.


Source Data

The source data is a set of address points, and a set of postcode (zipcode) boundaries.

Toothpaste expenditure per household is simulated by attaching a random number to each address.


Above: Sample of source data showing addresses and postcode boundaries


Workspace

The first thing to do in the workspace - after reading the source and generating some random data - is to overlay the address points and zipcode boundaries so that each address is tagged with a postcode attribute.

Now the StatisticsCalculator is set to calculate the number of addresses per postcode, and the average toothpaste expenditure per postcode. The means to do this is the Group-By function, which here is set to the zipcode attribute.



Above: The StatisticsCalculator settings dialog. Note the attribute to analyze and group-by parameters



Above: The workspace as a whole [nb: zipcode on the output is coloured red as the group-by attributes are erroneously being un-exposed - I'm sure this will be fixed soon]


Output

Note in the above output how 12292 features enter the StatisticsCalculator, but only 7 features exit. This indicates there are 7 groups (different postcodes) on which statistics were created.

The output is written to a plain CSV file.



Above: The output (tidied up slightly for clarity)

Attached Files
filesizedate
SC1.jpg28.5 kB12/05/07
SC2.jpg50.1 kB12/05/07
SC3.jpg94.7 kB12/05/07
SC4.jpg15.6 kB12/05/07
StatisticsCalculator.zip262.1 kB12/05/07
User Comments Add a new comment