嗨fme'ers,
Here’s post number 5 on theSchemapper.transformer. By now you should know all about this transformer, and be able to understand the concepts I’m talking about. If not, then please give yourself a refresher course starting at发布#1.

我开始写这篇文章来涵盖一些方面Schemapper.we’d overlooked so far; and that’s what I have done. However, during the course of coming up with these examples, things got fairly complicated and all of the topics actually interacted with each other more than I expected.

所以......把它视为公平的警告这篇文章比其余的时间长 - 但如果你打算使用这个问题Schemapper.变压器以严肃的方式。

Scenario
对于大多数这些主题,我将使用相同的例子:翻译一组管道数据。

I could be doing this for a number of reasons. Perhaps I am migrating all my data from one system to another, perhaps I am exporting data from my corporate GIS to supply as CAD drawings to some contractors, or perhaps I just wanted to merge a series of different source datasets. Either of these scenarios is realistic.

The point is that I wish to examine my source features and assign them different symbology, layers and attributes according to the status of the source dataset.

免责声明
我在此添加的免责声明是我的目的地符号系统都是假的!通常我会写入FME_COLOR或AUTOCAD_COLOR等格式属性,或类似的,以及对这些属性有效的使用值。

However in the interests of making the examples easy to understand and not specific to any particular format, I’ve used made-up attributes output_color, output_style and output_width, and made up values such as Red, Blue, Green, etc. If I really wanted to then I could map these to the proper attributes at the end using a ValueMapper (but you don’t need me to show you that).

多个子句
请记住,过滤器字段参数设置了一种“where子句”,由此fme可以将查找表中的映射匹配到映射所适用的功能。到目前为止,我们只看了一个单一条款,但多个条款并不难。

In fact an almost better reason to show this example is to demonstrate how theSchemapper.can actually map aspects of the data other than schema.

So, the first part of my lookup table will deal with these field fields. I have six items defined in the lookup table:

当我选择查找表作为Schemapper.source the preview looks like this:

要使用这些我,请设置多个过滤器字段,如下所示:

所以现在我有一个条款说......

如果垂度=依值率statusattr = statusvalue.TypeAttr = TypeValue

或者,给出一个具体的例子......

如果pipediameter = 6PipeStatus = AsBuiltPipeType = Water

所以,这就是定义多个过滤器字段条款的方式。

添加属性映射
在这种情况下,我想要做的一个是实际上为特征的符号系统设置了值,而不是仅仅是它们的架构类型和属性:

这是一个完全有效的任务Schemapper.. But, although you might not realize it yet, the big question is, should I add these to my lookup table as或者?

Instinctively you (and I) would probably add them as columns, in which case the preview looks like this in theSchemapper.巫师:

This looks OK; but then I’m only mapping three attributes. I could add more but as I do so my lookup table gets almost exponentially more complicated; and complicated isn’t good when part of the reason for using theSchemapper.是的,我们可以简单且容易地在工作台外部进行更改。

所以,FME最佳实践说我应该将每个属性添加为单独的. This way I get many more rows in my lookup table, but it’s not as hard to decipher when I want to make edits. TheSchemapper.preview now looks like this:

请注意,现在颜色,宽度和样式在单独的行上而不是在同一行上的单独列中。另请注意,唯一的新列称为SymbologyAttr和SymbologyValue,并且每个类型,直径和状态的每个组合都有三行;一个用于每个符号系统属性。

这是作用,因为FME在第一次找到它发现的匹配项中,但还要通过并执行它发现的所有映射。而且此技术也使映射字段对话框更易于,因为即使具有多个属性设置,我才需要定义一个映射,如下所示:

当我现在运行工作区时,我得到(例如)这个输出:

这里的源特征显然代表了一个10英寸的气体管道,其设计阶段。因此,已经分配了一种薄,红色的虚线的糖果。

默认值
您是否注意到上面映射字段对话框对话框没有为源属性设置的值?这与我以前展示的方式不同。

这是因为任务没有关于属性重命名,但是关于设置值。因此,我定义了目标属性(使用“destination属性”)并定义将其设置为(使用“默认值”)的值。

In fact, it’s possible to use virtually any combination of these three parameters, according to the situation you want to define.

这里的是“默认值”是有点误导,如果你只是认为它是“价值”,你可能会更好地理解它。

功能类型映射
行。现在我想将功能类型映射包含到同一查找表中。但我该怎么做?在我上一级示例的证据上,您可能认为我需要添加两个新列,SourceTypedestinationtype., and expose/create some new attribute with which to manage them through the Index Fields dialog.

这将是这样做的正确方法。

However, because it’s merely a case of setting the format attributefme_feature_type.,上面的例子显示了我可以将这些添加为新行,就像我为符号学做的那样,甚至没有触及Schemapper.建立。例如,我可能会添加该行:

Pipetype,Pill,Pipediameter,6,PipeStatus,Asdesigned,FME_Feature_type,Planned6inchwaterpipes

...在Schemapper预览中看起来像这样:

See how I just have an extra row for Feature Type, and so my output Feature Types are all set, and can then be handled with a fanout or similar in the workspace.

映射的顺序
但是,以上所有内容都以查找表中的线路缠结。例如,在我的查找表中给定这两行:

类型,天然气,Pipesize,10,CurrentStat,Asdesigned,Output_Color,红色类型,气体,Pipesize,10,CustryStat,Asdesigned,Output_Color,Green

... output_color将提供匹配的输出功能?两条线都有相同的条款,那么哪一个优先?红色或绿色?

答案是第二行获胜。那是因为 - 如上所示 - FME将继续在从桌子上的顶部工作的方式应用映射。因此,首先将分配颜色红色,然后将其被颜色绿色覆盖。

你可能想知道这一点......

1)Just in case you make a mistake and duplicate a set of clauses by accident.

2)Because you can use it to set a “default value”. For example, what would happen if I put this line at the top of my lookup table:

类型,气体,,,,,输出_color,绿色

好吧,你可以说这是一个默认或捕获 - 所有映射。“GAS”类型的所有功能都将匹配,并赋予颜色绿色(无论大小或状态)。但是,进一步在查找表中,具有匹配的Pipesize和CurrentStat的功能将被设置为红色。

Therefore, in my output, all features which are coloured green are those which didn’t match a full filter and get turned to red. So green features will be an error which I need to fix – but at least I’ve uncovered the problem.

但是,关键点是,这只会在捕获 - 全部在另一个映射之上时工作。如果它在下面,那么它将重置已经映射的任何东西。

3)因为你可以用它来做我打电话给“次要映射”。我只通过尝试使用这样的查找表来发现这一点:

OldType,Tree,NewType,Vegetation OldType,Hedge,NewType,Vegetation OldType,Grass,NewType,Vegetation NewType,Vegetation,NewColor,Green

你看到那里发生了什么吗?某些功能映射到类型“植被”,然后键入“植被”映射到彩色绿色。我正在使用新类型(而不是旧的),并通过这样做,从必须单独地将树,树篱和草坪进行单独地映射到新颜色。我将它们全部映射到一个新的功能类型和映射到适当颜色的功能类型。但是,当然,只有在颜色映射之前的特征类型映射,只有作品。

As a consequence of this, you want to be really careful if you map an attribute back to itself – for example map from fme_feature_type to a new version of fme_feature_type. That’s because the change applies immediately and any following mappings need to adhere to the new value of the type.

如果您想要真正(真的)复杂,那么您现在必须考虑在映射字段对话框之前是否应用索引字段对话框,或者如果它们一次同时应用它们。但坦率地说,我不知道,我不敢发现。只有一些人类人类从未打算过的东西!

哦!我们最好停下来。Scheamapper Dragon都晕了......

Wait till next time Dragon, when we do it all dynamically!

关于fme. 数据转换 动态架构 FME桌面 GIS. Schema 可用性

马克爱尔兰

Mark, aka iMark, is the FME Evangelist (est. 2004) and has a passion for FME Training. He likes being able to help people understand and use technology in new and interesting ways. One of his other passions is football (aka. Soccer). He likes both technology and soccer so much that he wrote an article about the two together! Who would’ve thought? (Answer: iMark)

评论

评论被关闭。

相关的帖子