span8
斯潘4
As of FME 2016.1,Postgis编写器还不支持Oracle和SQL Server编写器上可用的“处理多个空间列”选项。So writing to a Postgis Table which has multiple spatial columns requires a two step process.
Note: We have logged PR 17730 for PostGIS multiple geometry support.
必须使用pgadmin预构建具有多个几何列的PostGIS表,才能获得正确的表布局。The PostGIS table has been pre-built for the demo example,postgis-insert-update-2016.fmwt.
postgis-insert-update-2016.fmwt
使用FME 2016 +,it is easier to write multiple geometries to PostGIS.To write multiple geometry,必须先用一种几何图形类型插入特征,then updated with another.在此之前,必须在两个单独的工作区中进行。It is now possible to order the runtime processing of features,using Connection Runtime Order,so that the Insert and Update can be done in the same workspace.
The download postgis-insert-update-2016.fmwt is the complete workspace.如果您想自己创建工作区,please download Parks.zip,然后按照下面的步骤创建它。
Completed workspace
1.创建源表
To prepare for the exercise,please run createtable-city-parks.fmw to ensure the table is correctly set-up.
2.添加阅读器
Add a MapInfo (MTAB) Reader and set Dataset to Parks.tab.
3.Add INSERT Writer for Polygons
去找作家,Add Writer and add a PostGIS Writer.设置数据集以嵌入连接参数。Under Parameters...please enter:
Host:postgis.train.亚搏在线safe.com
端口:5432
数据库:FMEData
用户名:fmedata
密码:fmedata
将Postgis编写器功能类型连接到地图信息阅读器。In the Feature Type Properties of the INSERT Writer,under the General tab,please set the Table Qualifier to fmedata2016.In the Format Parameters tab,请为“feature operation”设置“insert”,为“table handling”参数设置“truncate existing”。In this example,the INSERT Writer will handle the polygon geometries.
插入写入程序格式参数
4。创建和重新投影点
Connect a CenterPointReplacer to the MapInfo (MTAB) Reader,to create another set of data flow.CenterPointReplacer创建点,然后添加一个重投影程序,将坐标系更改为LL84。最后,add a AttributeRemover to remove all attributes except for the key field,帕尔基德It is only necessary to pass through to the更新writer the key field of "parkid" - all other attributes can be removed from the feature.
5。为点添加更新编写器
去找作家,Add Writer and add a PostGIS Writer.将DataSet设置为使用与上面相同的参数嵌入连接参数。
将PostGIS编写器功能类型连接到attributereMover。在更新编写器的功能类型属性中,under the General tab,please set the Table Qualifier to fmedata2016.In the Format Parameters tab,请为“功能操作”设置“更新”,为“表处理”参数设置“使用现有”。
更新写入程序格式参数
6.设置连接运行时顺序
On the output port of the MapInfo (MITAB) Reader,右键单击并选择Set Connection Runtime Order...请将Parks->FMEData2016.City_Parks设置在位置1,将Parks->CenterPointReplacer设置在位置2。
Set Connection Runtime Order
7.运行工作区并使用pgadmin检查输出
Please examine the output in pgAdmin,由于PostGIS阅读器也不支持多个几何列,and by default FME's PostGIS reader will pick the first geometry column.在PGADmin中,please right-click on the table,选择查看数据,然后查看所有行。
Output viewed in pgAdmin
在FME 2016之前,a two workspace process is required,workspaces-for-inserts-and-updates.zip是演示。附加的zip文件包含两个工作区,其中显示了如何完成此操作。
1)运行none2postgis_insert.fmw工作区,将第一个几何类型插入表中。
2) Then run the other none2postgis_update.fmw workspace to UPDATE the table with the second geometry type.运行更新工作区(写入程序模式=更新)时,您必须将fme_where format属性设置为键值(在示例表中,它可以是fme_where id=1)。此外,还需要将空间列名参数更改为第二个几何图形。在上面的情况下,您将首先插入到空间列名geom,在更新工作区中,您将空间列名更改为geom2。
--2个空间列--放置表格public。“parkstwospace”;创建表格public。“parkstwospace”(parkid smallint,refparkid smallint,parkname character varying(40),neighborhoodname character varying(40),ewstreet character varying(30),nsstreet character varying(30),dogpark character varying(1),洗手间character varying(1),特殊功能character使用(oid=false)改变(1)、几何图形(几何图形,26910)、地理地理图形、约束公园的主关键字(parkid);更改表public。“parkstwospace”所有者为postgres;--删除索引public。“parks”几何图形“si”;--删除索引public。“parks”几何图形“si”;创建索引“parks”几何图形“si”在public上。“parkstwospace”使用gist(geom);创建索引“parks”地理图形“si”“公共”上的“公园空间”使用GIST(GEOG);
?2019安全亚搏在线软件公司|Legal