Add Attributes By Location

ERDAS IMAGINE Help

HGD_Variant
16.5.2
HGD_Product
ERDAS IMAGINE
HGD_Portfolio_Suite
Producer

Category:Feature Analysis

Default

Show All Ports

Add_Attribute__by_Location_operator_all

Description

Add Attributes By Location extends the schema of FeaturesIn with attributes from RelatedData and, for each feature in FeaturesIn, conditionally populates the values of these extended attributes with values from RelatedData.

When RelatedData is of type IMAGINE.Features, the values for the extended attributes of a feature in FeaturesIn are found by identifying the feature in RelatedData whose geometry is nearest to the FeaturesIn feature's geometry but also within SearchDistance. If no such feature is found in RelatedData, the extended attributes for the feature will have NULL values.

When RelatedData is of type IMAGINE.Raster, both band values (pixels) as well as any attributes in the attribute table of each band may be chosen to extend the schema of FeaturesIn. The values for the extended attributes of a feature in FeaturesIn are found by identifying the nearest neighbor pixel in RelatedData. If the point relates to a NoData pixel or is outside the raster extent of the raster, the extended attributes for the feature will have NULL values.

AttributesNames can be used to explicitly specify the attributes with which to extend the schema of FeaturesIn. If AttributeNames is unspecified, the schema of FeaturesIn will be extended by all non-geometry attributes of RelatedData.

The names of the added attributes will be constructed in the schema of FeaturesOut based on a concatenation of AttributeNamePrefix with the name of the attribute in RelatedData. For attributes that are band specific, the names will be based on a concatenation of AttributeNamePrefix, the band name and the attribute name in RelatedData

If such a constructed name matches as existing attribute name in the schema of FeaturesIn but the field types of the attribute in RelatedData and FeaturesIn are not compatible, the operator will fail. Otherwise, the value of the attribute in FeaturesOut will reflect the value of the related data in RelatedData (or will be NULL if no such data is found).

The tables below show the different scenarios for constructing the attribute names for the output feature.

AttributeNamePrefix

Attribute Names in RelatedData's Attribute Table

Value specified for AttributeNames port in operator

Attribute Name in the output feature stream

default

<attrname1>, <attrname2>, <attrname3>

RD_<attrname1>, RD_<attrname2>, RD_<attrname3>

default

<attrname1>, <attrname2>, <attrname3>

<attrname1>, <attrname2>

RD_<attrname1>, RD_<attrname2>

WV_

<attrname1>, <attrname2>, <attrname3>

WV_<attrname1>, WV_<attrname2>, WV_<attrname3>

Table: Output attribute name scenarios for the case where RelatedData are Features

AttributeNamePrefix

RelatedData

Attribute Names in RelatedData's Attribute Table

Value specified for AttributeNames port in operator

Attribute Name in the output feature stream

default

Single band raster

<attrname1>, <attrname2>, <attrname3>

RD_<bandname1>, RD_<bandname1>_<attrname1>, RD_<bandname1>_<attrname2>, RD_<bandname1>_<attrname3>,

default

Single band raster

<attrname1>, <attrname2>, <attrname3>

<bandname1>, <attrname1>

RD_<bandname1>, RD_<bandname1>_<attrname1>

WV_

Single band raster

<attrname1>, <attrname2>, <attrname3>

<bandname1>, <attrname1>

WV_<bandname1>, WV_<bandname1>_<attrname1>

default

3-band raster

<attrname1>, <attrname2>, <attrname3>

RD_<bandname1>, RD_<bandname2>, RD_<bandname3>, RD_<bandname1>_<attrname1>, RD_<bandname1>_<attrname2>, RD_<bandname1>_<attrname3>, RD_<bandname2>_<attrname1>, RD_<bandname2>_<attrname2>, RD_<bandname2>_<attrname3>, RD_<bandname3>_<attrname1>, RD_<bandname3>_<attrname2>, RD_<bandname3>_<attrname3>

default

3-band raster

<attrname1>, <attrname2>, <attrname3>

<bandname1>, <bandname2>, <attrname1>, <attrname2>

RD_<bandname1>, RD_<bandname2>,

RD_<bandname1>_<attrname1>, RD_<bandname1>_<attrname2>,

RD_<bandname2>_<attrname1>, RD_<bandname2>_<attrname2>,

default

3-band raster

[case where <attrname2> is not present for <bandname2>]

<attrname1>, <attrname2>, <attrname3>

<bandname1>, <bandname2>, <attrname1>, <attrname2>

RD_<bandname1>, RD_<bandname2>,

RD_<bandname1>_<attrname1>, RD_<bandname1>_<attrname2>,

RD_<bandname2>_<attrname1>

WV_

3-band raster

<attrname1>, <attrname2>, <attrname3>

<bandname1>, <bandname2>, <attrname1>, <attrname2>

WV_<bandname1>, WV_<bandname2>,

WV_<bandname1>_<attrname1>, WV_<bandname1>_<attrname2>,

WV_<bandname2>_<attrname1>, WV_<bandname2>_<attrname2>

Table: Output attribute name scenarios for the case where RelatedData is raster

Type-specific Behavior for RelatedData

Raster RelatedData

For each point in FeaturesIn, the pixel values as well as the attributes of the raster specified by AttributeNames at that point location are extracted and added as attributes of the point. By default all attributes per band and pixel values will be extracted. In the case where an attribute is not present in the attribute table for a specific band, the specific band-attribute will not be included.

If a sub-selection of bands is specified along with specific attributes from the attribute table, only the attributes for the bands specified will be generated in FeaturesOut.

When a point in FeaturesIn falls on a NoData pixel then the extracted values will be null.

Feature RelatedData:

For each feature in FeaturesIn, its new attribute values will be the attribute values of the first closest feature in the RelatedData whose distance from the feature is not bigger than the search distance specified in SearchDistance port. If no feature in RelatedData lies with the search distance of the FeaturesIn feature, its new attribute values will be null.

For line geometries, distance is zero if the point is on the line. Otherwise, distance is computed as the shortest (orthogonal) distance between the point and the line. If the distance is greater than the search distance the new attribute values will be null.

For polygon geometries, distance is zero if the point is contained within the polygon. Otherwise, distance is computed as the shortest distance between the point and an edge of the polygon.

By default all non-geometry attributes will be extracted.

Limitations

FeaturesIn must be point-type features.

The implementation is currently global with respect to RelatedData when it is a feature source.

Connections

Name

Objects Supported

Description

Shown by Default

Required

Default Behavior or Behavior if not Required

FeaturesIn

IMAGINE.Features

Features input which will have additional attributes added to it.

checkmark_gray

checkmark_gray

RelatedData

IMAGINE.Features

IMAGINE.Raster

Source of new attribute values

checkmark_gray

checkmark_gray

AttributesNames

IMAGINE.String

IMAGINE.StringList

Attribute name(s) from RelatedData specifying which values to add to FeaturesOut.

If an attribute name is specified that does not exist in RelatedData, it is an error.

For IMAGINE.Features, all non-geometry attributes will be extracted from RelatedData and added as attributes to the feature stream.

For IMAGINE.Raster, all attributes and pixel values for all bands will be extracted and added as attributes to the feature stream.

AttributeNamePrefix

IMAGINE.String

Prefix for output attribute names.

The string will be prepended to the the names of the RelatedData attributes (layer names) to form attribute names for the output feature stream.

SearchDistance

IMAGINE.Double

The max distance, in meters, a RelatedData geometry must be from a FeaturesIn point geometry to be considered the feature to transfer attribute values from.

SearchDistance applies only when RelatedData is Features and does not consider Z values.

FeaturesOut

IMAGINE.Features

The input features with additional attributes extracted from the RelatedData

checkmark_gray

Related Operators

Example Model