span8
斯潘4
Small polygons are those whose area is less than a specified tolerance.这些可以通过以下组合找到:measuring the area of polygons然后用滤波变压器施加一个试验条件。
对小多边形的测试是一个很好的质量保证测试,因为低于一定尺寸的多边形通常表示存在重叠等问题。条子,以及线条不齐。
It's also very simple to count how many of these bad features exist.然而,如下文所述,像这样的多边形自动修复更困难。
Count Small Polygons: Workspace as a Template
The first source dataset for this example is a set of lines (in an AutoCAD DWG dataset) representing the outlines of property boundaries in the City of Vancouver.
第二个数据集(ESRI地理数据库格式)是一组表示地址的点功能。
The datasets look like this in the FME Data Inspector:
这里的场景是我们希望将这些线转换为真正的多边形特征。That is very simple in FME,but we will add some QA checks to ensure that no undersized polygons are being created.特别地,an undersized polygon that contains an address point is very bad news.
Follow these steps to learn how to identify small polygon features.
1。Start FME Workbench and begin with an empty canvas.
从菜单栏中选择“读卡器>添加读卡器”。
Set the data format to Autodesk AutoCAD DWG/DXF.Select the attached dwg file as the source dataset.单击参数按钮,并将分组实体设置为“属性模式”。
单击“确定”,然后再次单击“确定”以添加读卡器。
2.The source dataset is made up of line features.To create polygons requires a single FME transformer: the AreaBuilder.
所以,add an AreaBuilder transformer.将其连接到parcellines功能类型。
三。为了测试小多边形,我们首先需要测量每个多边形的面积。This is done with the AreaCalculator transformer.
所以,add an AreaCalculator transformer and connect it to the AreaBuilder:Area output port.
4.In most cases we would now add a filter transformer to test the area.But in this example we're going to throw in an extra level of detail: address points.
再一次,从菜单栏中选择“读卡器>添加读卡器”。
这次将数据格式设置为esri geodatabase(文件geodb open api)。选择附加的地理数据库作为源。提示时,select only the PostalAddress table to add to the workspace.邮政编码边界表不是必需的。
5。要将地址点属性传输到多边形上,我们将使用PointOnAreaOverlayer转换器。
所以在reaoverlayer变压器上放置一个点。
将PostalAddress功能类型连接到PointOnAreaOverlayer:点输入端口和区域计算器:输出端口连接到PointOnAreaOverlayer:区域输入端口。
Test run the workspace by adding an Inspector transformer to the PointOnAreaOverlayer:Area output port.结果应该是一组具有多边形区域属性(_区域)的多边形特征,如果与地址点重叠,则为定义地址的属性。
6。Now let's filter the bad features.温哥华州建筑条例:
The floor area of a micro dwelling must be at least 29.7m2
我们在看地块边界,not building footprints,但是,30平方米似乎是一个很好的截止点,低于该点的多边形可能是错误的。
We want to test for three scenarios:
像这样测试多个条件的最好方法是使用一个testfilter变压器。
所以,add a TestFilter transformer connected to the PointOnAreaOverlayer:Area output port.
7。打开TestFilter参数对话框。Double-click in the first row under the Test Condition column.This will open us a condition editor.
在本编辑器中,set a test clause for _area is less than (or equal to) 30.Set up a second test clause for _overlaps is greater than (or equal to) 1:
如果这两条都是真的,多边形太小,包含地址点。But to test for both clauses - not just one or the other - set the Pass Criteria parameter to "All Tests (AND)"
最后,at the bottom of the dialog,将输出端口名称设置为“带地址点的小型”,然后单击“确定”返回上一个对话框。
Now click on the first test condition and then click the Duplicate button on the dialog.这将复制第一组子句并打开它们进行编辑。
Remove the second clause (for _overlaps) by clicking it and then clicking the "-" button.我们不需要测试重叠,因为任何有重叠的东西都将被过滤掉。
将输出端口名称设置为“不带地址点的小型”,然后单击“确定”。现在定义应该如下所示:
If so,单击“确定”返回主画布。
8。Connect Inspector transformers to each of the TestFilter output ports (rename the Inspectors if you want):
运行工作区。结果将是FME数据检查器中代表三种不同状态的三层。Inspect the features that are flagged as small to ensure that they are incorrect in some way.大多数是两条边界线相交的多边形,创建一个小的银色多边形。
计算坏特性的数量非常容易,因为我们已经将它们过滤掉了。例如,甚至工作台的特性计数也会告诉我们所涉及的数字:
To create a count stored in an attribute is simple using the StatisticsCalculator transformer.
按照以下步骤学习如何计算小多边形特征。
9。在第一个testfilter输出端口与其inspector transformer之间添加一个statisticscalculator。Open the parameters dialog.
First select _area as the Attribute to Analyze.In truth it doesn't really matter which attribute we select,因为我们只需要一些功能。
删除“计算属性”字段中的所有值,然后在“总计数”字段下添加“BadFeatures”。这将提供一些坏特性。Click OK to close the dialog.
10。复制现有的统计计算器(选择它并按ctrl+d)。将其连接在第二个testfilter输出端口与其检测变压器之间。
因为这是复制品,不需要打开它的参数对话框并进行任何更改。
11.重新运行工作区。这次,输出应该包含一个属性,该属性指示每种类型有多少坏特性。
NB:如果您将StatisticsCalculator:Summary输出端口连接到检查器,只有一个输出特性。To get all output features ensure that the Complete port is connected.
Fixing small polygons is not a simple task.简单地删除这些特性可能会导致拓扑覆盖上的空白,and not all of them will have a common ID number by which to merge (dissolve) them together.
然而,有一些解决方案可以应用:
a)删除小多边形,然后使用除渣变压器以填补剩余数据中的任何空白。
b)选择一个与小多边形相邻的特征,并将两者融合在一起。
按照以下步骤学习如何修复小多边形特征,使用邻居查找器/溶解器。
12。删除两个统计量计算器,if you added them in step 11,and any remaining Inspector transformers.
13。添加一个连接到testfilter的计数器变压器:
14.添加邻居查找变压器。将小多边形功能(来自testfilter的其他两个端口)连接到neighfinder:base,and connect the Counter:Output port to the NeighborFinder:Candidate
In FME2018 or newer,默认情况下,合并属性参数未设置,必须手动设置。
15。添加溶解变压器。连接邻居查找器:匹配的端口,and also create a second connection out of the Counter:Output port to the Dissolver.Your workspace will now look like this:
16.Open the Dissolver parameters dialog.将group by参数设置为“_count”。这将导致小多边形溶解到它们的邻居中。
17。Attach an Inspector transformer and run the workspace.大多数小多边形都是通过分解到相邻的多边形中来固定的:
您可以添加一个最终的区域计算器转换器来帮助证明这是事实,如果您不想从视觉上检查数据。
Instead of using an AreaCalculator,您可以直接在像测试仪这样的过滤器变压器中使用@area()函数。We use the AreaCalculator here to make the final workspace a little clearer.
修复数据的解决方案依赖于具有共享边界的小多边形的最近邻居。两个小多边形不能固定,因为它们的最近邻只共享一个顶点,因此无法溶解。
The data used here originates from open data made available by the City of Vancouver,不列颠哥伦比亚(数据.couver.ca).It contains information licensed under the Open Government License - Vancouver.
?2019安全亚搏在线软件公司|Legal