Working with List Attributes: ListHistogrammer

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2020.0

Introduction

This article is part of the tutorial: Transformers for Working with List Attributes

A number of FME transformers are specifically designed to work with list attributes - ListHistogrammer is one of them. These can be used to create, manipulate, transform, and analyze lists. Lists are created in FME with 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 find the park with the most trees as well as find out how many of each species is 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:

WRKjq_miaYB-YqZUF6v41YxMZAmMSeW7KT4wwlwCePWC0IbOK7ppmrwajnZKmR8_j5sDEfpMgTP1h7jGFsnCQJ9Z6IHC_vUZ7kuuYdJR0h5t7sT191eYO9Ej4cljLnYEKGk6D74

 

In the ListHistogrammer workspace, the user needs to count how many features there are of each type (zone) in a set of zoning data. This can be achieved by creating an artificial aggregate and 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 shows an interesting use of the AttributeExposer to import the values from the Zoning data so that the newly generated attributes can all be exposed and inspected.

 

gotV2Q3zNFPXxr9gLsPmHmlPvoRWmgqJuDf_i8fti0EiQw1KMEtRvbw6SIgH4NZmJ4RXwxgkkBvAGanfmm71M0-LP2T9x8jdE2atCCwakfUTe0H6fMTDekw6_mlfXiwgHXoZDsU

 

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.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.