斯潘8
斯潘4
下载
Often,a new FME workspace creates database tables that are a duplicate of the incoming data.However,sometimes a user will wish to write to a database table that already exists.
当表已经存在时,工作区应该反映表模式(而不是源模式)。这是通过从数据库中导入该表的模式来实现的。添加数据库编写器时,the import option allows us to use the schema of a database table that has been previously created.
Note: This example is also applicable to the PostgreSQL format.
A number of bike paths are already stored in PostGIS.Additional Vancouver bike path data,stored in Shapefile format,将添加到PostGIS中的现有自行车路径数据中。
使用数据检查器查看自行车后座
1) Add Reader
启动FME工作台。在“开始”页上选择“新建工作区”选项。这将创建一个空白画布。
From the Readers menu,选择添加读卡器。Enter Esri Shapefile for the format,and select the BikePaths_L.shp file for the Dataset.单击确定。自行车路径数据将添加到工作区。
ESRI形状文件阅读器
2a)添加写入器
选择“编写器>添加编写器”并输入Postgis作为格式,然后选择Postgis培训数据库(在中设置查看和检查PostGIS) as the Dataset.If you do not have this named database connection,选择嵌入连接参数的选项,然后选择Parameters...手动输入连接参数:
为PostGIS编写器嵌入连接参数
现在,我们将从现有表中导入架构以在编写器中使用:选择“从数据集导入”作为表定义。
从数据集导入表定义
2b)导入要素类型
FME将首先询问从何处导入特性类型。在这种情况下,它们与编写器数据集的位置相同(尽管这可能并不总是正确的)。将弹出另一个对话框,提示您选择要导入的表。对于格式和数据集,select the same dataset as the writer above.
导入编写器功能类型参数
单击“参数…”按钮,为表列表的模式设置fmedata2015,并在表列表选择器中选择bikepaths。
fmedata2015.BikePaths set as table to import
The schema definition of the selected table is now added to the workspace.请注意,编写器功能类型是现有数据库表架构的副本(而不是读卡器功能类型,作为一个标准的工作空间。
3)设置功能操作和工作台处理
检查writer模式参数是否设置为insert,并将表处理更改为使用现有的。
格式参数-功能操作和表格处理
Navigator window - Feature Operation & Table Handling
4)地图模式
因为我们的Postgis数据库存储的属性名称都是小写的,在读写器和写器之间存在属性不映射的问题。
单击“展开”按钮,展开读写器功能类型的属性列表。
The attributes are mixed case on the input,但在输出的情况下,因此,如果没有正确映射,它们将无法传输。
源和目标属性在情况下不匹配
右键单击连接线并选择自动连接属性。As only the case varies between the source and output,the Auto Connect Attributes will correctly map the input and output attributes.然后再次右键单击连接线并选择“用attributeManager替换链接”。
Note that if the workspace is run more than once then new data will be added repeatedly!
运行工作区后,inspect the PostGIS output in Data Inspector to view the BikePaths table.
数据检查器中的BikePaths
?2019安全亚搏在线软件公司|合法的