SPAN8.
SPAN4.
With FME Server and FME Desktop, we can use an area of interest polygon (e.g. a city boundary) to clip a set of user-specified layers that fall within it This is different than the more traditional approach of reading the entire set of layers and then clipping the features.
要执行此任务,将使用FeatureReader变压器。此变换器可让我们使用任何格式,实际上允许将空间过滤器应用于用户指定的图层。
此外,FeatureReader允许您动态地将数据写入目标功能类型,了解它读取的任何表。这可以通过<架构>端口,该端口提供使用模式定义的编写器。此方法令人难以置信的灵活性,因为不同的数据层可以读入工作流程然后写出。亚搏在线
以下是逐步指南。请参阅附加的工作空间以获取已完成示例。
这是将用于在空间过滤所需数据的功能。将在此边界中找到的所有功能将被读入工作流程。亚搏在线
将新MapInfo选项卡读取器添加到画布。
格式: MapInfo TAB (MITAB)
Dataset:
此选项将允许基于所选择的区域类型选择不同的边界来允许最终用户的灵活性(例如,工业与住宅)。在Navigator中,右键单击已发布的参数,然后选择“添加参数”。创建一个新的“选择”参数并从MapInfo文件导入区域类型。
a)右键单击导航器中发布的参数,然后选择“添加”。输入以下内容:
b)单击“配置”按钮,然后在以下屏幕上选择“导入”:
C)Read the Zones .Tab file and setup import mode:
Click 'Next'.
单击“导入”以引入类别。
Select 'OK' to save the parameter.
额外的信用
Using a Web Mapping Tool: If your users are drawing the area of interest in some kind of web mapping tool, you could send the vertices of this polygon to a new published parameter, then create a polygon from these vertices using the Creator and a combination of transformers.
使用where子句:如果您的用户通过添加读取器选择感兴趣区域,则可以发布该读取器(如果适用于格式)的Where子句以提供用户灵活性。(在我们的示例中,MapInfo没有此功能,因此我们必须创建一个参数)
上面的两种方法都可以在单个工作空间中组合,为用户提供选项。
区域数据集中的每个区域类别由多边形组成。正如我们要使用单个区域作为边界,我们需要将这些功能聚合到有组织的功能中。为此,我们将使用灾难域,聚合器和测试仪变压器。
一种)Place the Dissolver on the canvas connected to the MITAB reader and set the following:
小组由:Zonecategory
b)Add an Aggregator:
小组由:Zonecategory
C)使用我们发布的参数(类型)添加测试符:
Left value: ZoneCategory Operator: = Right Value: $(TYPE)
在此阶段,我们将阅读我们对其感兴趣的实际数据层,并通过作者写出。这是我们想要由边界多边形过滤的数据。
将FeatureReader添加到画布并将其连接到测试仪。然后设置以下内容:
格式:Postgis.
Dataset: Embed Connection Parameters
PostGIS credentials:
主持人 | postgis.train.亚搏在线safe.com. |
港口 | 5432 |
Database | Fmedata. |
User | Fmedata. |
密码 | Fmedata. |
要读取的功能类型:public.parks(键入此文本或使用“...”按钮搜索)
Spatial Filter:包含
输出>输出端口:Single Output Port
Output > Attribute and Geometry Handling >
选择“确定”。
Run the workspace and inspect the output. You should notice that only the park data that exists inside your selected boundary polygon remains. At this stage only Parks would be read into the workspace so we can improve the flexibility by giving the users a choice of layers.
To do this, a second published parameter needs to be created to allow users to select which layers (i.e., feature types) they want. In the FeatureReader, select the dropdown arrow next to ‘Feature Types’ and choose ‘User Parameter > Create User Parameter’, then select Fixed List to choose from layers stored in the database. Select: ‘public.Roads, public.Parks and public.AddressPoints’ and then choose 'OK' to create the parameter.
额外的信用
您还可以将参数作为文本字段创建。文本字段允许在创作工作空间时输入的选项;他们需要通过其他程序手动输入或通过,例如使用FME服务器的Web应用程序。您将用户的选择作为空格分隔列表发送到此参数。例如:“地址点邻居”。
Since the workspace is quite flexible in what it can read, the writer will need to be setup in dynamic mode to ensure that the data can be written out.
将通用编写器添加到画布中,然后选择“Autodesk AutoCAD DWG / DXF”作为参数中使用的格式。运行工作空间时,您可以将此更改为出现提示时的任何格式(强大!)。
笔记: The workspace will work as is for file and folder based formats. For other formats such as cloud-based and databases, it is necessary to set additional writer parameters, to specify and connect to the desired destination.
The Generic format allows the user to have a choice of format. Then set the mode to Dynamic and Schema Source as “Schema from Schema Feature”.
为了在FME中写出数据,编写器功能类型需要知道它将使用的模式。在这种情况下,我们需要使用FeatureReader的数据作为我们的模式。
我们怎样才能获得架构?
As of FME 2015 the FeatureReader has an additional output port "
笔记: To use fixed schema mode (not shown in this example) you will need to add a writer and destination feature types for any table the user may possibly read. Use the FeatureTypeFilter transformer to route the features to the appropriate destination feature type.
现在使用的提示和运行选项执行workspace. Try different Zone Types and Tablenames to generate different sets of output.
发生了什么是由启动器功能触发FeatureReader变压器。在我们的情况下,这是区域数据的一组边界多边形。如果我们有10个边界多边形,那么FeatureReader就会执行10次。如果启动器功能较少,性能最好。
When the FeatureReader is initiated it connects to the format and reads the feature types specified in the TableNames parameter. The transformer allows for Spatial Filtering so using the "Contains" clause means that the features that are returned are contained by the Initiator polygons. Then the writer dynamically takes all the features and writes them to their respective layers based on the incoming layer name and schema. Any features that fell outside of our bounding box are not included.
©2020 S亚搏在线afe Software Inc |合法的