FACTORY_DEF <ReaderKeyword> AggregateFactory
[FACTORY_NAME <factory name>]
[INPUT FEATURE_TYPE <feature type>
[<attribute name> <attribute value>]*
[<feature function>]*]*
[LIST_NAME <list name>{}]
[ACCUMULATE_ATTRIBUTES]
[GROUP_BY [<attribute name>]+]*
[OUTPUT (AGGREGATE|SINGLETON)
FEATURE_TYPE <feature type>
[<attribute name> <attribute value>]*
[<feature function>]*]*
This factory takes a series of features matching an input specification and aggregates their geometries together based on attribute values specified by the GROUP_BY clause. One feature is output for each group resulting from the GROUP_BY clause. If no GROUP_BY clause is specified, then all features fall into the same group and a single feature is output. Features are added to the aggregate being built in the order they are received by this factory. If the order of individual features within the resulting aggregate is important, users can first route the features through a SortingFactory.
The features output from the AggregateFactory have the combined attribution of all features combined to make up the aggregate.
The optional LIST_NAME clause is used to associate attributes with each member of the aggregate. When the aggregate is created, all attributes of each feature joining the aggregate are added as members of the specified attribute list. The index in the list corresponds to the index of the feature's geometry in the aggregate.
If the optional ACCUMULATE_ATTRIBUTES clause is specified together with the optional LIST_NAME clause, then each singleton feature that is output will also have a list created on it holding the attributes of the single feature that it was based on. As well, this clause causes the attributes of each member feature of an aggregate to be merged onto the feature being output, in addition to be accumulated in the list.
This provides functionality very similar to the ListFactory. Either the ElementFactory or the DeaggregateFactory can then be used to extract the attributes from the list.
Tips |
When large aggregates are created, the list can require a great deal of memory. In some situations, the @KeepAttributes should be used in the AggregateFactory’s input clause to reduce the number of attributes that become part of the list. |
This factory is similar to the ListFactory. The ListFactory aggregates attribution, while the AggregateFactory aggregates geometry (and possibly also attribution). |
Features with geometries aggregrated by this factory may be routed to formats that accommodate aggregates for output.
Tip |
The DeaggregateFactory is used to split aggregates up into their components. |
If the OUTPUT SINGLETON clause is specified, features that are the only members of their group are output unchanged (but if the ACCUMULATE_ATTRIBUTES and LIST_NAME clauses were present, singleton will have a list of their attributes added as well). If OUTPUT SINGLETON is not specified, an aggregate containing only one geometry will be output for the group.
Assumptions
None.
Output Tags
The AggregateFactory supports the following output tags.
Tag |
Description |
AGGREGATE |
The features that have aggregate geometry. If the SINGLETON tag is specified, then each of these features will have at least two geometries in it. |
SINGLETON |
Applies to features that are the only members in a group. If this is not specified, then such features are output using the AGGREGATE tag creating a geometric aggregate with only one geometry in it. If an OUTPUT SINGLETON clause is specified, such features are output unchanged. |
The following example illustrates the use of the AggregateFactory to merge linear contour features together based on their elevation value.
FACTORY_DEF SAIF AggregateFactory \
INPUT FEATURE_TYPE Contour::TRIM \
GROUP_BY position.geometry.value \
OUTPUT AGGREGATE FEATURE_TYPE ContourAggregate
Tip |
Since no OUTPUT SINGLETON clause is specified, groups that have only 1 element in them will still be output as an aggregate. |
The features below match the input specification of this factory definition and will enter the factory.
Feature Type: Contour::TRIM |
|
Attribute Name |
Value |
position.geometry.qualifier |
definite |
position.geometry.value |
20 |
Coordinates: (477553,5360181,20) (477554,5360182,20) |
Feature Type: Contour::TRIM |
|
Attribute Name |
Value |
position.geometry.qualifier |
indefinite |
position.geometry.value |
20 |
Coordinates: (377553,4360181,20) (377554,4360182,20) |
The factory merges the above features together, to produce the aggregate feature below. This feature could be output to Shape or SAIF.
Feature Type: ContourAggregate |
|
Attribute Name |
Value |
position.geometry.qualifier |
definite |
position.geometry.value |
20 |
Coordinates: Line 2: (377553,4360181,20) (377554,4360182,20) |
Tip |
The qualifier attribute was copied from the first feature that was encountered in the group. |