AttributeCreator
Typical Uses
- Add a new attribute to a feature and assign it a value
- Add a new empty attribute to a feature for use elsewhere in the workspace
How does it work?
Blank rows are provided where you can enter new attribute names and (optionally) set values for them. One or more new attributes may be added, and all features that pass through the transformer are modified according to these selections.
New attributes are added at the top. Duplicate names are not identified, and are not added more than once.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
- 在此示例中,将三个新属性添加到输入功能中:
- UPDATEDBY is added and set to the constant value “Smith”.
- X and Y are added, and set to the feature’s coordinates by extracting geometry with an FME function.
The new attributes are reflected in the transformer, at the top of the attribute list.
属性值已更新,可以在数据检查器的表视图中查看。
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
Adjacent Feature Attributes are accessed under Advanced: Attribute Value Handling. When turned on, you can specify a number of features preceding and following the current feature to reference in calculating new values.
Suppose we are given the dataset below:
ID |
Latitude |
Longitude |
---|---|---|
0. |
4.9.1640 |
-123.061 |
1 |
4.9.1643 |
-123.063 |
2 |
4.9.1642 |
-123.062 |
3. |
4.9.1642 |
-123.064 |
If the现有功能数量andNumber of Subsequent Featuresparameters are both set to 2, then when the first feature is read, the AttributeCreator has access to the following features:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
特征[-2] |
|||
feature[-1] |
|||
current feature |
0. |
4.9.1640 |
-123.061 |
feature[+1] |
1 |
4.9.1643 |
-123.063 |
特征[+2] |
2 |
4.9.1642 |
-123.062 |
请注意,某些属性丢失,因为第一个功能之前没有存在功能。
读取第二个功能后,attributecreator可用的先前和后续功能的窗口以产生以下内容:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
特征[-2] |
|||
feature[-1] |
0. |
4.9.1640 |
-123.061 |
current feature |
1 |
4.9.1643 |
-123.063 |
feature[+1] |
2 |
4.9.1642 |
-123.062 |
特征[+2] |
3. |
4.9.1642 |
-123.064 |
This statement would calculate the average latitude of the two preceding features:
Calculations referencing adjacent features can be created in the Arithmetic Editor and the Text Editor. These editors will list the attributes of the currently processed feature first, then the prior features, then the subsequent features.
Usage Notes
- Consider using theattributemanager.instead
Configuration
Input Ports
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
This transformer accepts any feature.
输出Ports
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
Features with the new attributes and optionally defined values.
参数
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
When an AttributeCreator is opened for the first time, this area will contain a blank row where a new attribute can be created. Additional rows are added as entries are made.
New Attribute | 输入新属性的名称。 |
Attribute Value | New attributes can be left without a value for use elsewhere, or you can set new values here by clicking in the appropriate row and:
看Defining Values下面有关使用这些选项的详细信息。 |
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
扩展高级部分提供对可用于定义值的相邻功能的属性的访问。虽然此部分可能会出现复杂,但大多数用户很少需要此功能。
检查“启用相邻的功能属性”以使用此功能。
You can now set an attribute value (in the Attribute Actions matrix) based on the attributes of features prior or subsequent to the current feature by referencing them as follows:
- Attributes of prior features are referenced as feature[-1].AttrName, feature[-2].AttrName, etc.
- Attributes of subsequent features are referenced as feature[+1].AttrName, feature[+2].AttrName, etc.
- Attributes of the currently processed feature are accessed directly without a prefix, such as AttrName.
检索先前功能的值时,attributecreator对该功能的任何更改都将生效。
现有功能数量
此参数指定attributecreator可以引用的最大现有功能数。如果启用了多个功能属性支持,则这必须是0到100的值。由于必须为处理的每个要素读取其他功能,仅定义要检索所需的最大功能数将提高性能。
Number of Subsequent Features
这个爸爸rameter specifies the maximum number of subsequent features that can be referenced by the AttributeCreator. If Multiple Feature Attribute Support is enabled, this must be a value from 0 to 100. As additional features must be read for each feature processed, defining only the maximum number of features needed to be retrieved will improve performance.
Substitute Missing, Null, and Empty by
此参数指定当引用的属性不存在时的所需行为,具有空值,或具有空字符串值。
Such attributes can be thought of as unresolved attributes. For example, since there are no features prior to the first input feature, the AttributeCreator will fail to resolve the value of feature[-1].AttrName for the first input feature. If this parameter is set toNo Substitution,attributecreator将使用空字符串解析所有未解决的属性。
As another example, if the value of feature[+2] is the empty string andDefault Value指定,那么空字符串将被视为未解析的属性,并且将被解析为默认值下指定的值。
If this parameter is set toClosest Adjacent Feature,如果存在这样的功能,则未解决的属性将被解析为最近特征的相应属性。查找最近的功能时,跳过具有未解决属性的功能。如果先前或后续功能具有未解决的属性,则可能使用当前功能来解决缺失属性。
For example, if the value of feature[-2].AttrName is unresolved, then to resolve the value of feature[-2].AttrName the AttributeCreator will look at the closest features to feature[-2], alternating between features prior to and subsequent to feature[-2]. It will first look at feature[-3].AttrName, followed by feature[-1].AttrName if needed, and then feature[-4].AttrName if needed, until all prior and subsequent features specified have been exhausted.
如果属性在spe仍未得到解决cified prior and subsequent features, then it will be resolved as the value specified in the Default Value parameter.
Default Value
这个爸爸rameter specifies the value used to resolve unresolved attributes in these cases:
- 替换丢失,null和空的:设置为Default Value
- 替换丢失,null和空的:设置为Closest Adjacent Featureand a value is not found in within the number of prior and subsequent features specified.
Dialog Options
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
Row Reordering |
Enabled once you have clicked on a new attribute in the list. Choices include:
|
Filter |
Start typing a string, and the matrix will only display rows matching those characters. Searches all columns. This only affects the display of attributes within the transformer - it does not alter which attributes are output. |
Import |
The import button will populate the transformer with a set of new attributes read from a dataset. If the transformer already contains new attribute entries, these attributes will be appended to the existing list. |
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, clickbeside the applicable parameter. For more information, seeTransformer Parameter Menu Options。
Defining Values
有几种方法可以在变压器中定义使用的值。最简单的是简单地输入值或字符串,其可以包括各种类型的函数,例如属性引用,数学和字符串函数和工作区参数。有许多工具和快捷方式可以帮助构造值的值,通常可以从与值字段相邻的下拉上下文菜单中提供。
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
Using the Text Editor
The Text Editor provides a convenient way to construct text strings (including regular expressions) from various data sources, such as attributes, parameters, and constants, where the result is used directly inside a parameter.
Using the Arithmetic Editor
The Arithmetic Editor provides a convenient way to construct math expressions from various data sources, such as attributes, parameters, and feature functions, where the result is used directly inside a parameter.
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
Content
Expressions and strings can include a number of functions, characters, parameters, and more - whether entered directly in a parameter or constructed using one of the editors.
![Closed](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/../Skins/Default/Stylesheets/Images/transparent.gif)
这些功能操纵和格式化字符串。 | |
A set of control characters is available in the Text Editor. | |
Math functions are available in both editors. | |
These operators are available in the Arithmetic Editor. | |
These return primarily feature-specific values. | |
可以使用FME和工作区的参数。 | |
使用用户参数 | Create your own editable parameters. |
Reference
处理行为 |
特征为基础 |
功能持有 |
No |
Dependencies | None |
FME许可级别 | FME Base Edition and above |
Aliases | |
History | |
Categories |
FME知识中心
The FME Knowledge Center is the place for demos, how-tos, articles, FAQs, and more. Get answers to your questions, learn from other users, and suggest, vote, and comment on new features.
Search for所有结果关于attributecreatoron the FME Knowledge Center.