Files
-
- 100 KB
- Download
Introduction
This example is intended to show what a group is in a group based transformer.
Step-by-step Instructions
This exercise involves calculating statistics for parking meters in the city of Vancouver. The important part is to explore how to group data and what effect that has on performance and attributes.
1) Start FME Workbench. Begin with an empty workspace.
2) Select Readers > Add Reader from the menubar (or Ctrl+Alt+R) and in the Add Reader dialog select MapInfo TAB (MITAB) as the format and select the attached dataset for the source (or C:\FMEData2017\Data\Transportation\ParkingMeters\Meters.tab)
This will add a reader with a single feature type (layer) to the workspace.
3) Add an Inspector transformer connected to the reader feature type and run the workspace. All of the source data will open as a single layer in the Data Inspector
4) Now set the Inspector transformer parameter called Group-By. In the parameter select the attribute CreditCard:
Re-run the workspace. In the Data Inspector now you have two layers: one containing parking meters that accept credit cards, one containing parking meters that don’t.
Lesson: This shows how data can be formed into groups based on attribute values.
5) Now set the Group-By parameter again for the Inspector. This time make sure both the CreditCard and MeterType parameters are selected. Re-run the translation. The result is now four layers:
- Single meters that accept credit cards
- Single meters that don’t accept credit cards
- Twin meters that accept credit cards
- Twin meters that don’t accept credit cards
Lesson: This shows how groups can be made up of several attributes, not just one.
6) Delete the Inspector transformer and add a StatisticsCalculator transformer to the workspace, connected to the reader feature type. In the parameters dialog select HourlyRate as the attribute to analyze. Set:
- Minimum Attribute: MinRate
- Maximum Attribute: MaxRate
- Mean Attribute: AveRate
7) Connect an Inspector transformer to the StatisticsCalculator:Summary output port and run the translation. Notice that there is a single feature representing the entire “group” of source data, which has attributes MinRate, MaxRate, AveRate (but no other attributes).
Back in Workbench make a note of the peak memory use as recorded at the foot of the log window.
8) In the StatisticsCalculator parameters, set the Group-By parameter to Neighborhood. This will cause a group of meters to be created for each neighborhood. Re-run the workspace.
Notice that there is now an output feature for each group. Notice that the attributes now includes the Neighborhood attribute.
Lesson: This shows when a group of features is combined together in some way, the only attributes that emerge are those common to the group.
Back in Workbench make a note of the peak memory use as recorded at the foot of the log window. It should be almost identical to what the amount was previously.
Lesson: This shows that grouping features together has no effect on the system resources used; it is still the same whether the data is one large group or several smaller groups.
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.
Comments
0 comments
Please sign in to leave a comment.