斯潘8
span4
The above video covers theory covered in this article,和编写Arcgis地理数据库附件例子
地理数据库关系类用于管理一个要素类中要素与另一个要素之间的关系。属性和非属性关系类可以用FME读写。关系与其他功能不同,不是表或功能类中的行,但通过起点和终点特征的主要和外部关键值建立联系。
“原始”功能属于在ArcCatalog中创建关系类时指定的“原始表/功能类”。while "destination" features belong to the "Destination Table/Feature Class".
Relationship classes can be simple or composite,以及属性化或非属性化。
有关Arcgis中关系的更多信息,请参考:http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationships-and-arcgis.htm(http://desktop.arcgis.com/en/arcmap/10.3/manage-data/relationships/relationship
请注意,本文中使用/提到的ESRI文件geodatabase reader/writer需要获得许可的Arcgis版本。For more information on required ArcGIS license levels,请看FME地理数据库格式所需的ARCGIS许可证类型。TheSDE和地理数据库的FME读写器比较也可能有用。
关系示例可在正在写入地理数据库关系类
简单VSComposite:
在“简单”的关系类中,features can exist independently of each other – for example a feature can exist without necessarily having an attachment,并且可以删除任何附件而不影响功能。
In a "Composite" Relationship class,源对象和目标对象之间的连接更紧密。如果功能被删除,那么相关的附件记录也会被删除。
Attributed vs.非归属:
In a non-attributed relationship,关系类包含在一个非空间表中,该表只包含源和目标功能键。
In an attributed relationship,关系类包含在一个非空间表中,该表的属性多于标识键。
阅读关系类
在读关系课的时候,源和目标要素类必须与关系类同时读取。A relationship feature type shows an allowed geometry of eithergeodb_relationship或geodb_归因于_关系。
Each relationship feature has the following Format Attributes stored on it when read from a relationship class:
这些属性可用于标识工作空间中源要素和目标要素之间的关系。这些属性用于FME的过程,as format attributes,and do not appear in the final written output.
性能
请注意,从关系类中读取非常慢,因为读取时会验证每个关系。因为通常不需要这种功能,FME包括一个参数,默认情况下,关闭关系读取以提高性能。因此,要读取关系类,必须首先找到并停用“忽略关系信息”参数。
Writing Relationship Classes
Relationship classes cannot be created through FME and must be set up through ArcGIS prior to running the translation.一旦在Arcgis中定义了关系,以下属性必须存储在写进FME中关系类表的功能上(这只与m:n和属性化关系相关,因为您直接与关系表交互。):
以下属性必须存储在写入源和目标要素类/表的要素上,这些要素参与到关系中(这适用于所有类型的基数(1:1,1米:m:n和属性)):
注:
写入关系类所需的属性:
对象 | Required Attributes |
Origin feature class or table | 土拨鼠 geodb_feature_has_relationships =yes |
目标要素类或表 | 土拨鼠 geodb_feature_has_relationships =yes |
关系类 | geodb相关原点 地理数据库相关目标 GeodbyType =geodb_relationship或地理数据库属性关系 表处理:Use Existing |
例如,如果原始特征的geodb_oid=1,而目标特征的geodb_oid=2,the feature written to the relationship table must have these attributes:
geodb_rel_origin_oid=1
geodb_rel_destination_oid = 2
关系:插入,update or delete
Note that features participating in an归属关系可以插入,updated and deleted.但参与的功能非归属关系can only be inserted and deleted.因为属性化关系有关联的中间表,中间表的属性(不包括键值),可以通过提供一个RID(关系ID)作为更新/键字段进行更新。
In a geodatabase,关系键不必是对象ID(整数)类型。例如,它们可以是一个guid。在这种情况下,很容易在关系中加载外键属性。你不需要这么做。You only need to set the values of geodb_rel_origin_oid & geodb_rel_destination_oid.The FME Geodb writer will populate the relationship feature class foreign keys.
仅使用一个地理数据库编写器:如果工作区中有多个地理数据库编写器,请小心。The origin and destination feature classes (or tables) that participate in the relationship and the relationship class must be written by the same Geodatabase writer (i.e.you cannot write to feature classes with one Geodatabase writer and to relationship classes with another).
有时,源和目标要素类中的数据已经存在,您只想add the relationships到关系表。您可以在以下情况下执行此操作:
-关系是m:n或属性关系
-关系类已存在于geodb中
将geodb_type设置为geodb_relationship或geodb_attributed relationship(如果已属性化),将geodb_rel_origin_oid和geodb_rel_destination_oid设置为各自的objectid。这确实要求FME读取参与关系的特性类,但不涉及再次将它们写出。Only the relationship table needs to be written to in this case.
关系背景
必须使用ArcGIS工具创建关系,as they cannot be created in FME.
1:1,1:m非归属关系:These have no intermediate table for keeping track of relationships.They are linked using a primary (origin table) and foreign (destination table) key.
M:N和任意1:1,1:M or M:N attributed relationships:单独的表用于跟踪关系。为了跟踪这些关系,每个关系条目都包含一个唯一的RID值以及主键和外键。
文件地理数据库和SDE地理数据库:
1:1,1:m非属性化特征类:如果使用FME插入,则要么从空的要素类开始(因为一旦在arcmap中创建关系,关系已经完成)或者您将删除并重新插入参与关系的功能,从而重建关系。
仅限文件地理数据库-不包括SDE地理数据库:
1:1,1米:m:n属性关系和m:n非属性关系:If you have populated feature classes and need to insert into the relationship table to populate it,or you want to update or insert attributes in an attributed relationship table,you may simply insert into the relationship table directly without writing to the feature classes which participate in the relationship.这包括主键/外键和/或属性。这里假设您已经定义了一个表或具有这些关系的某个源。这可能是一个不太常见的工作流程,但它是可行的,可能是一个亚搏在线好的高级帖子,或者只是我们作为旁白添加到其中一篇文章中的内容。一般来说,您将同时插入到要素类和构建/插入关系表中。
SDE地理数据库:
1:1,1米:m:n属性关系和m:n非属性关系:
FME只能用于更新属性关系中的属性,不是RID,外键和主键。If this is desirable,必须执行删除和插入操作。
目前,没有一种方法可以将现有的关系属性插入到带有SDE地理数据库的关系表中,而不必读取参与该关系的功能来获取objectid。这在一定程度上是因为在Arcgis中填充这些关系需要交互地选择源站和目的地,而不仅仅是定义关系。As such,如果参与关系类的功能已经存在于数据库中,并且只需要填充关系表,the features which participate must still be read.这是为了获取对象ID,但是,这些特性不会被写回。The ObjectID's read from the origin and destination relationship features will need to be renamed to the geodb_rel_origin_oid and geodb_rel_destination_oid respectively in order for the relationship table to be populated.
A little more on deleting records for a relationship class...
You can delete individual records from a relationship class.为此,您可以:
?2019安全亚搏在线软件公司|合法的