Files
Introduction
This article is part of the tutorial: Transformers for Working with List Attributes
Several FME transformers are specifically designed to work with list attributes, including ListHistogrammer. These can be used to create, manipulate, transform, and analyze lists. Lists are created in FME using a wide range of transformers; see "Creating Lists Using Transformers" for more details.
ListHistogrammer
Workspace examples: WorkingWithLists2020.fmwt and ListHistogrammer2020.fmwt
The ListHistogrammer builds a histogram of the values found in a list and returns these in a new list attribute. The new list will be sorted so that the value with the most occurrences will be first. Using this transformer with the data in the Working With Lists workspace, we can easily identify the park with the most trees and determine the number of each species represented within each park. As a bonus, you can specify your own histogram list name, making it possible to have multiple histograms on a single feature.
Here we’re counting the occurrence of each tree species within a single park using the ListHistogrammer:
In the ListHistogrammer workspace, the user needs to count the number of features of each type (zone) in a set of zoning data. This can be achieved by creating an artificial aggregate and a list of the source data, and subsequently running it through the ListHistogrammer.
The workspace actually goes one step further: it uses a custom transformer to convert the histogram into a set of attributes and values. It also demonstrates an interesting use of AttributeExposer to import values from the Zoning data, allowing all newly generated attributes to be exposed and inspected.
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.