SPAN8.
SPAN4.
Welcome to the FME for Smallworld 5 tutorial. This article covers importing data into your Smallworld 5 database, including how to handle incremental updates to the Smallworld database.
一旦信息存储在数据库中,它的源不太可能保持静态:将发生更改。本文讨论了如何使用FME对您的小型数据库进行增量更新。基于现实世界的变化,保持数据库最新。在FME Workbench中,这是使用格式属性:fme_db_operation完成的。可以在文章中找到使用fme_db_operation更详细的详细信息:更新数据库。
您已在上一个使用“FME_DB_Operation”格式属性文章。FME使用SmallWorld Writer上的“FME_DB_Operation”属性指定每个功能的数据库操作插入,更新或删除。
更新或删除操作时,还必须提供与Writer功能类型上的Smallworld“sys_id”匹配的加入键属性。FME将自动识别使用此加入键属性写入的记录。
When the operation is INSERT, the join key attribute should not be included on the feature. For inserted records, Smallworld automatically creates an internal ‘sys_id’, and the insert operation may fail if the writer attempts to supply a join key.
Cambridge_Electricity_Updates.gml
一世n the previous article, electrical supply points and cables were proposed for new customers. These proposed changes have now be Accepted. Some new connections are now required and also some existing connections need to be updated or removed. This example will update the Smallworld database with these changes to the electrical system.
在此示例中,您将使用由更改管理系统创建的GML文件。update_type属性作为d,u,i(删除,更新或插入)跟踪更改。
1) Inspect Source Dataset
检查源数据集Cambridge_Electricity_Updates.gml
Some features have no geometry. All features have an update_type attribute that indicates the type of database operation to perform: I (Insert), U (Update) & D (Delete).
2) Add Smallworld Alternative
一世n the Smallworld Version Management application, select the alternative fme_updates or add this new alternative if it doesn’t already exist:
D.ataset | 替代名称 |
Electricity | fme_updates. |
3)生成工作区
开始FME工作台。在“开始”选项卡上,选择要生成工作区的选项。
读者格式: | GML (Geography Markup Language) |
读者数据集: | |
Writer Format: | 小世界4/5 |
Writer Dataset: | localhost:30000 |
Writer Coord. System: | OSGB-GPS-2015 |
Parameters > Service | FME. |
Parameters > Alternative | | fme_updates. |
Place a check mark on the Import feature type definitions checkbox.
一定要使用|符号作为替代品的第一个字符
单击“确定”以生成工作区。
4)指定要素类型
出现“导入撰写创器要素类型”对话框时,单击“参数”按钮。
Set these parameters:
服务:FME.NOFACTORY
表列表:
出现GML选择要素类型对话框时,请选择以下功能类型:
5) Tidy Workspace
The feature types on the reader may be in a different order than on the writer. To make the feature type names easily visible, you can select the feature types and resize them, or add an annotation can be attached to each feature type.
To add an annotations, select all the feature types. Right-click and choose Attach Annotation.
整理工作空间,使每个读者功能类型与其匹配的作者功能类型水平对齐;但是尚未连接它们。
6)设置数据库操作
添加连接到读取器功能类型的attributevaluemapper变压器。update_type属性标识到每个功能适用的操作类型。
Source Attribute: | update_type |
New Attribute Name: | fme_db_operation. |
Source Value: 一世 你 D. |
D.estination Value: |
右键单击变压器并使用重复键进行两个副本的变压器,并将重复连接到剩余的功能类型,如下所示:
7.) Set Geometry Name: centerline & location
在上一节中,您将设置电缆和供电点的几何名称。将GeometRPropertySetter变压器连接到attributevaluemapper以供电点和电缆,并分别将几何名称设置为“位置”和“CentReline”。
为什么不需要“客户”功能类型的几何实体替换器?
笔记:FME Snamporworld 5 Writer以完全不同的方式处理小世界的几何形状4. SmallWorld 4版本的工作空间都附加在本文底部以供参考。几何类型不再暴露为属性,不再使用sworld_geometry {}列表属性。旧工作区仍然在SmallWorld 5中兼容。
8)连接到Writer功能类型
将attributevaluemapper或attributecreator输出端口连接到其关联的编写器功能类型。
Your workspace will look something like the one below:smallworldex6-complete.fmwt.
FME如何使JOIN达到SmallWorld对象以进行更新和删除?FME使用sys_id(或等效)来将Join与Mandmworld对象进行更新和删除。在此示例中,这是ID属性(Cable&Supply_point)或Customer_ID(客户)。
9) Inspect Output
Click on Writers > Redirect to FME Data Inspector to turn off the Smallworld writer and output to Inspector instead.
Save the workspace and then run it.
检查FME数据检查器中的输出。使用检测工具选择电缆和供电点,然后验证其属性。请注意,对于INSERT的ID(或客户的Customer_ID)缺失。这是因为它是一个新功能,尚未创建一个“sys_id”。
这是会发生的事情:
功能类型 | 手术 | 特征计数 |
顾客 | 插 | 4. |
cable | 删除 | 3. |
cable | 插 | 7. |
supply_point. | 删除 | 3. |
supply_point. | 插 | 3. |
supply_point. | 你PDATE | 1 |
全部的: | 21. |
10) Write the Output
在FME Workbench中,单击作家>重定向到FME数据检查器,将输出引导到小型Worliter。
暂停:您是否在写入正确的小世界替代品?
Run the workspace.
打开“小型专业人员(核心) - SmallWorld Core”应用程序。
你se the “Electric Network” bookmark to zoom in to see the area of interest around at Oak Tree Avenue.
检查小河的输出。在SmallWorld版本管理器中,双击“FME_Updates”以使其成为当前的替代方案。您可能需要刷新GIS视图。
Locate the inserted cables and supply_points.
Compare the fme_updates alternative to the top to detect the records that were deleted.
你se the object Explorer to locate the "customer" records that were inserted, since without geometry they won’t appear in the view.
There is a relationship between the Supply Points and the Customer table that uses an intermediate join table. The Smallworld 5 writer cannot create joins through an intermediate join table, so the supply_points have not been joined to their customers. You would have to accomplish this in the Smallworld GIS Object Editor.
FME.can be used to import objects that have a direct join (parent/child) relationships. These can be a simple 1:0..n simple joins, 1:0..n heterogeneous joins or 1:0..n multiple joins. Handling joins is described in theSmallworld FME Translator Documentation- 翻译SmallWorld RWOS - 加入字段的字段(您需要获取GE SupportCentral的登录)。您将在稍后的文章中使用Join Fields。
插入的供电点具有标签,标签位置来自供电点位置的几何形状。
一世n the Smallworld Version Management dialog double click on the "begin" checkpoint to rollback to the original data.
返回FME Workbench,修改工作区以将标签几何图中添加到新电源点。暗示:使用一个偏移变压器。你的变化r workspace will be similar to the previous section where you added labels to the supply points.
运行工作区,在SmallWorld中检查重新插入的电源点现在具有新的标签位置。
FME为小河5作家创建几何特征的方式存在差异,与SmallWorld相比。在Smallworld 5.下面的示例显示了如何为Smallworld实现此目的4.小世界5作家仍然支持这种旧方法,所以如果您有现有的工作空间,它们将与SmallWorld 5兼容,而且应该运行,无需更改它们。
©2019 S亚搏在线afe Software Inc |Legal