AttributeManager
Typical Uses
- 创建一个新属性,并以各种方式设置默认值或新值
- Modify existing attributes by renaming, and deleting them, and set or clear values for them
- 重新订购属性
- Set an attribute value based on features that come before or after the current feature
- Simplify a workspace by consolidating multiple attribute-manipulating transformers into one place
How does it work?
属性of the input features are presented in a matrix of rows and columns, where you can perform multiple tasks. All features that pass through the AttributeManager are modified according to the selections made in the parameters.
Examples
In this example, several attributes of the input features are modified:
- GlobalID is renamed, changing the case of the attribute name. Several address attributes are renamed as well.
- A new attribute “FULLNAME” is created, concatenating the values of two other attributes
- Several unwanted attributes are removed
- X and Y attributes are created and values are assigned by extracting geometry with an FME function
- “UPDATEDBY” is created and set to the fixed value “Smith”.
- All other attributes pass through untouched
The altered attributes are reflected in the transformer.
在Advanced:属性值处理下访问相邻的功能属性。打开时,您可以指定在当前功能之前的多个功能,以便在计算新值时参考。
Suppose we are given the dataset below:
ID |
Latitude |
Longitude |
---|---|---|
0 |
49.1640 |
-123.061 |
1 |
49.1643 |
-123.063 |
2 |
49.1642 |
-123.062 |
3 |
49.1642 |
-123.064 |
If theNumber of Prior Features和后续功能的数量parameters are both set to 2, then when the first feature is read, the AttributeManager has access to the following features:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
feature[-2] |
<缺失> |
<缺失> |
<缺失> |
特征[-1] |
<缺失> |
<缺失> |
<缺失> |
目前的功能 |
0 |
49.1640 |
-123.061 |
feature[+1] |
1 |
49.1643 |
-123.063 |
feature[+2] |
2 |
49.1642 |
-123.062 |
不te that some attributes are missing because no features exist prior to the first feature.
读取第二个功能后,可用于AttributeManager可用的先前和后续功能的窗口以产生以下内容:
Feature Reference |
ID |
Latitude |
Longitude |
---|---|---|---|
feature[-2] |
<缺失> |
<缺失> |
<缺失> |
特征[-1] |
0 |
49.1640 |
-123.061 |
目前的功能 |
1 |
49.1643 |
-123.063 |
feature[+1] |
2 |
49.1642 |
-123.062 |
feature[+2] |
3 |
49.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.
Configuration
输入端口
此变形器接受任何功能。
Output Ports
具有创建和修改的属性的功能。
Parameters
替换丢失,无效,空 |
指定所需的属性不存在的所需行为,具有空值,或具有空字符串值。 Such attributes can be thought of as unresolved attributes. For example, since there are no features prior to the first input feature, the AttributeManager will fail to resolve the value of feature[-1].AttrName for the first input feature. 如果此参数设置为没有替代,AttributeManager将使用空字符串解析所有未解决的属性,如果它们用于更大的表达式。如果未解析属性直接分配,并且不是更大的表达式的一部分,则输出属性将以相同的方式取消解决。例如,如果b丢失,则a设置为@Value(b), then A will be missing as well. But if A is set to“B = @Value(b)”,一个将具有价值"B = ". As another example, if the value of feature[+2] is the empty string andDefault Valueis specified, then the empty string will be treated as an unresolved attribute, and will be resolved as the value specified under Default Value. 如果此参数设置为最近的相邻特征, then the unresolved attributes will be resolved as the corresponding attribute of the closest feature, if such a feature exists. When looking for closest features, features with unresolved attributes are skipped. If a prior or subsequent feature has unresolved attributes, it is possible that the current feature is used to resolve the missing attributes. For example, if the value of feature[-2].AttrName is unresolved, then to resolve the value of feature[-2].AttrName the AttributeManager 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. If the attribute remains unresolved within the specified prior and subsequent features, then it will be resolved as the value specified in the Default Value parameter. |
Default Value |
此参数指定用于在这些情况下解析未解析属性的值:
|
启用相邻的功能属性
启用后,您可以设置属性值(在Attribute Actions表基于当前功能之前或之后的特征属性,通过引用它们如下:
- 属性of prior features are referenced as feature[-1].AttrName, feature[-2].AttrName, and so forth.
- 后续功能的属性称为特征[+1] .attrname,功能[+2] .attrname等。
- 属性of the currently processed feature are accessed directly without a prefix, such as AttrName.
When retrieving the value of a prior feature, any changes made by the AttributeManager to that feature will take effect.
Number of Prior Features |
This parameter specifies the maximum number of prior features that can be referenced by the AttributeManager. If Multiple Feature Attribute Support is enabled, this must be a value from0to100.. As additional features must be read for each feature processed, defining only the maximum number of features needed to be retrieved will improve performance. |
后续功能的数量 |
This parameter specifies the maximum number of subsequent features that can be referenced by the AttributeManager. If Multiple Feature Attribute Support is enabled, this must be a value from0to100.. As additional features must be read for each feature processed, defining only the maximum number of features needed to be retrieved will improve performance. |
当第一次连接并打开AttributeManager变压器时,此矩阵将自动填充包含当前存在的传入功能的属性。它还将动态调整以反映工作空间的上游属性变化。
默认情况下,操作将设置为“do nothing”并通过未置换的功能。当您对单个项目进行更改时,FME根据输入解释适当的措施。可以手动覆盖动作,但您一般不应需要调整它。
输入Attribute | 首先打开变换器时,将填充到发送到输入端口的公开属性的完整列表填充此列。此字段不可编辑,但会更新以反映工作空间中所做的更改。创建新属性时,此字段将保持空白。 |
Output Attribute | By default, the Output Attribute matches the Input Attribute. You can:
|
属性值 | 默认情况下,属性值为空,留下功能不变。您可以通过单击相应的行和:来设置新值:
See定义值below for detailed information on using these options. |
Action | 默认情况下,操作设置为“do noth”,留下功能不变。在参数中进行更改时,操作将自动调整以反映适当的结果,在某些情况下可以手动覆盖。可用的行动是: Set Value:将属性设置为“属性值”列中指定的值。覆盖现有属性值。 Do Nothing: Leaves the attribute unaltered. Rename: Renames the input attribute to the name specified in the Output Attribute column. Remove: Deletes the attribute entirely and removes it from the output schema. Set Default Value:将属性的指定值分配给缺少属性的特征。不会覆盖当前值,包括null。 NOTE:
|
Editing Transformer Parameters
使用一组菜单选项,可以通过引用工作区中的其他元素来分配变压器参数。一些变压器也可提供更高级的功能,例如高级编辑器和算术编辑器。要访问这些选项的菜单,请单击除适用的参数旁边。有关更多信息,请参阅Transformer Parameter Menu Options.
定义值
有几种方法来定义一个值供我使用n a Transformer. The simplest is to simply type in a value or string, which can include functions of various types such as attribute references, math and string functions, and workspace parameters. There are a number of tools and shortcuts that can assist in constructing values, generally available from the drop-down context menu adjacent to the value field.
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
算术编辑器提供了一种方便的方法来构建来自各种数据源的数学表达式,例如属性,参数和特征函数,其中结果直接在参数内使用。
Conditional Values
Set values depending on one or more test conditions that either pass or fail.
Parameter Condition Definition Dialog
内容
Expressions and strings can include a number of functions, characters, parameters, and more.
When setting values - whether entered directly in a parameter or constructed using one of the editors - strings and expressions containing String, Math, Date/Time or FME Feature Functions will have those functions evaluated. Therefore, the names of these functions (in the form @<function_name>) should not be used as literal string values.
These functions manipulate and format strings. | |
Special Characters |
A set of control characters is available in the Text Editor. |
两个编辑器都有数学函数。 | |
Date/Time Functions | 文本编辑器中提供日期和时间函数。 |
这些运算符可在算术编辑器中使用。 | |
These return primarily feature-specific values. | |
FME and workspace-specific parameters may be used. | |
创建和修改用户参数 | 创建自己的可编辑参数。 |
对话框选项 - 表格
Transformers with table-style parameters have additional tools for populating and manipulating values.
行重新排序 |
Enabled once you have clicked on a row item. Choices include:
|
Cut, Copy, and Paste |
Enabled once you have clicked on a row item. Choices include:
Cut, copy, and paste may be used within a transformer, or between transformers. |
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 |
Import populates the table with a set of new attributes read from a dataset. Specific application varies between transformers. |
重置/刷新 |
Generally resets the table to its initial state, and may provide additional options to remove invalid entries. Behavior varies between transformers. |
不te:不t all tools are available in all transformers.
参考
Processing Behavior |
Feature-Based |
Feature Holding |
不 |
Dependencies | 没有 |
FME Licensing Level | FME基本版及以上 |
Aliases | |
History | Released: FME 2016.0 |
FME Community
The FME Community 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 forall results about the AttributeManageron the FME Community.
Examples may contain information licensed under the Open Government Licence – Vancouver and/or the Open Government Licence – Canada.