Merge Features

ERDAS IMAGINE Help

HGD_Variant
16.5.1
HGD_Product
ERDAS IMAGINE
HGD_Portfolio_Suite
Producer

Category: Feature Analysis

Operator Pack: Feature Analysis

Associated Namespace: HexagonGeospatial.FeatureAnalysis.MergeFeatures

Default

MergeFeatures_Operator

Show All Ports

Merge Features ShowAll Operator

Description

This operator merges groups of features together based on attribute matches and/or spatial relationships, summarizing data for the groups via functional attributes. It is a two-step operation, involving first the grouping of input features, then second the creation of output features from those groups.

Step 1: Grouping. The features given through the FeaturesIn port are compared for matches in each of the identified attributes (if any), and/or coincidence within the primary geometry field (using the Touch spatial relationship). There is a logical “and” among all of these merging criteria. Null values are considered not equal to one another whether found in attributes or geometry fields. Features with null values for any of the match attributes or the primary geometry field are never merged with other features. It is also possible to merge all input features into a single output feature.

Examples:

  • By specifying "Merge All" as merge criteria, it is possible to merge all road features into a single output feature for calculating total length of roads under maintenance.
  • By specifying "Merge Matching Attributes" as merge criteria with a road type attribute, it is possible to merge all features of a common type (e.g. Primary Road), allowing calculation of total length by road type.
  • By specifying "Merge Touching Geometries and Matching Attributes" as merge criteria with a road name attribute, it is possible to combine the many segments of a single road normally broken at intersections, and calculate the total length of each specific road.

Step 2: Summarizing. The result is a new output set of features in which each feature represents the merging of one or more input features. The output features have one or more fields defined by the SummaryAttribute ports, which summarize the data of the grouped features using expressions. The schema of the output features has no primary key.

Examples:

  • Most often there is a summary attribute which merges geometries, of the form “MERGE(Input.Geometry)”.
  • It is also common to compute summary statistics on numeric attributes (for example SUM or AVERAGE or COUNT).
  • When data values within a group are known to be constant, for example because they were grouped based on that attribute value, the expression function FIRST can be used to capture that common value on the output features.

The input features may be nongraphic (no primary geometry field), or may have point, line, or area geometry. When merged, the geometries of all features in the group are consolidated into a single collection. Within that collection, behaviors vary by geometry field type:

  • Areas are merged geometrically and interior boundaries dissolved when suitable (i.e. faces that share an edge are merged).
  • Lines are merged geometrically and connected end-to-end when suitable (i.e. edges connected by nodes of degree 2 are merged including edge reversal as needed).
  • Points that are identical are reduced to a single point.

All geometry types are supported including arcs, composites, collections, and boundaries with holes. Z values are retained but one is selected according to context when there are multiple Z values at a node.

This is a global sink operator, as it must evaluate all features and group them before the first output can be produced. Topology is used both for determining spatial coincidence in the grouping activity (if applicable), and for generating merged output geometries (if applicable).

The following diagrams present input and output features for various scenarios of area, line, and point features; as well as grouping based on attribute matches and spatial coincidence. The graphic labels "A" and "B" in the diagrams represent attribute values for each input feature instance, and the graphic labels "1", "2", etc. represent discrete output feature instances. Nongraphic data is portrayed only for those cases which are available for nongraphic data (the Merge Touching Geometries choice is not available).

Input Data

Mer Merge Features Operator Input diagram 2 Merge Features Operator Input diagram 3 Merge Features Operator Input diagram 4

Merge Criteria = "All"

Merge Features Operator Touching diagram 1 Merge Features Operator All diagram 2 Merge Features Operator All diagram 3 Merge Features Operator All diagram 4

Merge Criteria = "Merge Touching Geometries"

Merge Features Operator Touching diagram 1 Merge Features Operator Touching diagram 2 Merge Features Operator Touching diagram 3

Merge Criteria = "Merge Matching Attributes"

Merge Features Operator By Attribute diagram 1 Merge Features Operator By Attribute diagram 2 Merge Features Operator By Attribute diagram 3 Merge Features Operator By Attribute diagram 4

Merge Criteria = "Merge Touching Geometries and Matching Attributes"

Merge Features Operator By Attribute and Touching diagram 1 Merge Features Operator By Attribute and Touching diagram 2 Merge Features Operator By Attribute and Touching diagram 3

Limitations

  1. When geometry is used either for grouping or merging, the operator always operates on the primary geometry field of FeaturesIn.

Connections

Inputs

Name

Data Type(s)

Description

Shown by Default

Required

Default Value or Behavior (must xist if not Required, may exist otherwise)

FeaturesIn

IMAGINE.Features

Input features which will be grouped and merged. If merging based on spatial coincidence, the primary geometry field is used.

checkmark_gray

checkmark_gray

Criteria

IMAGINE.String

Indicates whether geometric relationship, attribute match, both, or neither are to be applied in determining features to merge. Acceptable values are:

  • Merge All
  • Merge Touching Geometries
  • Merge Matching Attributes
  • Merge Touching Geometries and Matching Attributes

In the case of nongraphic features, only Merge All and Merge Matching Attributes are permissible values, otherwise an error is generated.

In the case of Merge Matching Attributes and Merge Touching Geometries and Matching Attributes, the MatchAttributeNames port must be populated. If it is not, then an error is generated.

checkmark_gray

If at runtime the port has not been explicitly set, then it defaults to Merge Touching Geometries if the input features are graphic, and defaults to Merge All if the input features are nongraphic.

MatchAttributeNames

IMAGINE.String

IMAGINE.StringList

Required if Criteria is set to Merge Matching Attributes or Merge Touching Geometries and Matching Attributes. If not provided, then an error is generated.

Ignored if populated when Criteria is set to Merge All or Merge Touching Geometries..

If populated with a single String representing an attribute name, indicates that features are to be merged into groups based on common values in that attribute.

If populated with a StringList representing multiple attribute names, indicates that features are to be merged into groups based on common values in those attributes. Order in the list is not important.

Only attributes of the following types are supported (if the name of an attribute of any other type is provided, then an error is generated):

  • Boolean
  • String
  • Byte
  • SByte
  • Int16
  • Uint16
  • Int32
  • UInt32
  • Int64
  • UInt64
  • Single
  • Double
  • Decimal
  • Currency
  • DateTime

If a given attribute name does not exist in the input Features, then an error is generated.

checkmark_gray

SummaryAttribute1

SummaryAttribute<N>

IMAGINE.FunctionalAttribute

Definition of a functional attribute which summarizes data from the merged input features. This port is repeating, so that multiple functional attributes can be defined.

checkmark_gray

If at runtime the port has not been explicitly set, then it defaults to internally creating a functional attribute with a field name of "Geometry" and an expression of "MERGE(<geom>)" where <geom> represents the name of the primary geometry field of the input features. If the input features are nongraphic then an error is generated.

Outputs

Name

Data Type(s)

Description

Shown by Default

FeaturesOut

IMAGINE.Features

Output features containing records representing grouped input features, with fields as defined by the one or more SummaryAttribute# ports, providing summary information for those features.

checkmark_gray

Related Operators

Syntax

HexagonGeospatial.FeatureAnalysis.MergeFeatures ( <FeaturesIn>, <Criteria>, <MatchAttributeNames>, <SummaryAttribute1>,... )