你在这里: 亚搏在线工作流程 > Schemapper.

Schemapper.

Converts the existing schema (data model) of features to a new structure, based on mappings defined in an external lookup table.

当映射可能复杂或需要由不熟悉FME的人维护时,这种技术非常有用。使用外部查找表定义这些映射简化了这些任务的完成。

SchemoMapper变压器使用的模式映射查找表定义了一系列要满足的条件(过滤器),以及在满足条件时将执行的一系列操作。

查找表可以采用不同的格式,例如:分隔的逗号或纯文本文件;电子表格(Excel或Google);或者数据库,如Oracle,Postgres,Informix,SQL Server等。

如果传入功能与表中任何行中的规则匹配,则按照以下类型列出该功能上的变压器的潜在操作,如下所示:

地图功能类型:

特征类型 - 由fme_feature_type定义 - 从它们的现有值映射到定义新功能类型的值。例如:

道路→中心线

地图属性:

该功能上的一个或多个属性通过将其现有的属性名称重新命名为新功能来映射。例如:

Name_of_Road → RoadName

设置新属性:

创建一个新属性,其名称和值在查找表中定义。

变压器港口

通过它们执行的动作的功能通过Mapped港口。否则,它们通过了未映射港口。

除了要素类型外,每个功能的几何形状都不会被留下。

功能输出通过Mappedport will receive a new attribute that specifies which rows from the schema mapping table that were applied to the feature. The rows are specified as a comma-separated string (for example, '3,4,5'). This attribute is specified by the选定的行属性parameter, and can only be changed from within the Navigator pane. Setting this parameter to a blank value will prevent the attribute from being added to features.

Schemapper使用

You can use the SchemaMapper for:

Domain Mapping:可以根据定义域或查找表重新映射属性值。例如:

  • 主要路线→美国高速公路
  • Secondary Route → Interstate Highway
  • 主要路线→县路

动态翻译:创建工作空间以处理任何数据结构

自动模式映射:在源和目标模式之间的手动连接使用外接查找表自动完成。

注意:A schema mapping table (domainSchema.csv) is often derived from a database metadata document such as Esri's XML database schema description, which can be exported from ArcCatalog for any selected geodatabase (Export > XML Workspace Document > Schema Only).

示例:使用SchemaMapper Transformer

The following example describes a typical scenario

Feature Type Mapping

使用外部查找表(.csv文件),您可以通过将旧功能类型映射到新功能类型来映射要素类型以简化架构:

旧功能类型 New Feature Type
运河
Road Transportation
铁路 Transportation
飞机场 Transportation

属性映射

使用外部查找表,您可以将属性映射到新名称:

Old Attribute New Attribute
river_name. 水诺
River_alt_name. altwatername.
河_Country watercountry
River_Length. 水Size
River_owner. 水东

Filters

您可以使用过滤器来设置映射规则。例如,如果要将“旧管道类型”映射到“新管道类型”,则可以根据管道的大小设置规则(过滤器):

旧管道类型 管尺寸Attribute 管尺寸 New Pipe Type
Gas PipeSize 6. Gassmall.
Gas PipeSize 12. 汽油饲养场
Gas PipeSize 24. GasLarge
直径 6. Watersmall.
直径 12. 水Medium
直径 24. 滑水机械
污水 PipeDiam 6. 污水Small
污水 PipeDiam 12. 污水Medium
污水 PipeDiam 24. Sewaglarge.

使用特征类型映射和过滤的示例

您可以使用SchemaMapper向导来定义filters and the type of mapping that you need. You accomplish this task by creating actions to be executed on the source schema.

To open the SchemaMapper wizard, click the Properties button of the transformer. The SchemaMapper Parameters dialog opens.

  1. 指定要使用的模式映射表(查找表)的格式和位置。您可能想要编辑格式参数,但您可以使用WorkBench提供的默认值。点击下一步。
  2. 如果数据集具有多个表,请指定要使用的表。点击下一步。
  3. 在“创建操作”窗格中,单击“添加”并选择“操作类型”。对于此示例,我们将选择要素类型映射。
  1. 选择源和目标功能类型字段。您可以显示/隐藏表列,并刷新内容。

  1. Click OK to return to the Create Actions pane, which now shows the Feature Type Map action you just set.

注意:要将源模式转换为新架构,您可以根据要应用于现有模式的映射规则创建多个操作。

  1. To add another action, select from the Add drop-down menu. In this example, we'll select Filter to display the Create Filter dialog:

  1. 在属性名称和值字段中选择表列。默认情况下,忽略空白属性值,但您可以选择包含它们。
  2. 单击“确定”以返回“创建操作”对话框。“操作”列现在显示了两个操作:地图功能类型和过滤功能:

  1. 单击“完成”以设置SchemaMapper参数。

更多信息

Editing Transformer Parameters

使用一组菜单选项,可以通过引用工作区中的其他元素来分配变压器参数。一些变压器也可提供更高级的功能,例如高级编辑器和算术编辑器。要访问这些选项的菜单,请单击除适用的参数旁边。有关更多信息,请参阅Transformer Parameter Menu Options

变压器类别

亚搏在线工作流程

FME许可级别

FME专业版及以上

Search FME Knowledge Center

Search for samples and information about this transformer on theFME知识中心