span8
span4
span8
span4
This article contains a number of writing geodatabase relationship classes examples.It includes demos for concepts covered in介绍工作与地理数据库关系类。Examples cover 1:M Relationship, Inserting into a M:N M:N or Attributed Relationship, and Advanced M:N Relationship.
For the following examples, it is assumed that the relationships have already been created in ArcGIS.This is required, as FME cannot create the relationships, but merely populate them.
* ESRI的文件在这篇文章中地理数据库读/写器使用/所提要求的ArcGIS的行货版本。有关要求ArcGIS许可级别的详细信息,请参阅要求ArcGIS许可类型为FME地理数据库格式。该FME读者和作家的SDE和地理数据库的比较文章也可能是有用的。
注意:FME不能创建在目标地理数据库中的关系类。无论是创建在ArcGIS / ArcPro关系类,或者使用 模板。
In this example, a 1:M relationship class translation will be demonstrated.As mentioned in the previous article, when dealing with a relationship class that is centered around a 1:M category, there is no intermediate table to keep track of these relationships.As such the relationships are bound to each other through the Primary and Foreign Keys.
脚步
1) Open the provided workspace ‘One2ManyRelStart.fmwt’ or open a blank workspace and add an ‘Esri File Geodb’ reader.
If you opened the provided workspace, skip to step 3.
2) For the Esri File Geodb reader, navigate to the 1ManyRelStart.gdb.Select it and click OK.
Click OK again.该 reader should be added, when asked select Parcels and Neighborhoods feature types.The reader should be added, when asked select Parcels and Neighborhoods feature types.
3) Add an AttributeCreator to each Feature class, with the new attribute being
‘geodb_feature_has_relationships’ and the value being ‘yes’.
4) To the same ‘AttributeCreator’.Rename the 'ObjectID' to the 'geodb_oid' for the origin and destination feature class.This is done to tell the writer which features are related.You have to make sure that the geodb_oid is the ID for origin table.For example: to build a relation between parcels and neighborhood use the OBJECTID (origin table) and the NeighbourID (destination table).
AttributeCreator参数
5) Now it is time to add the writer to the workspace.Writers > Add Writer.Select ‘Esri File Geodb' as the format.
Select the Folder location where you would like to save the output geodatabase, and give the geodatabase a name.
Click parameters, and set the Import XML Workspace Template to the supplied XML document: ‘XMLWorkspaceTemplate.XML’.This will allow you to write to a new geodatabase using a template that will provide the schema (includes the relationship class).
注意:除非每完成翻译后更改输出名称,删除XML模板初始转换后,允许现有的地理数据库的覆盖。
点击运行。工作区应成功完成。检查任何ArcGIS产品的地理数据库。你应该能够看到哪些功能使用ArcMap涉及到。下面是ParcelID一个例子:144。由此可以看出,作为关联的基斯兰奴邻里。
有时,在出发地和目的地的要素类的数据已经存在,你只是想的关系添加到关系表。如果你能做到这一点:
- 的关系为M:N或归因关系
- 关系类已经存在于地理数据库
要添加的关系时,geodb_type到geodb_relationship或geodb_attributed关系(如果归结)和geodb_rel_origin_oid和geodb_rel_destination_oid设置为各自的OBJECTID的。这要求该FME读取其参与的关系,但不涉及重新写出来的要素类。只有关系表需要在这种情况下被写入。
脚步
通过观察工作区,你可以看到从地理数据库两个要素类中被读取。在我们继续之前,让我们先来看看我们从阅读地理数据库。
2)打开ArcCatalog和导航到保持地理数据库中的文件夹中包含的
FMWT文件。
从看地理数据库,我们可以看到2个表(结构和地址)以及一个关系类(Structure_to_Address_rel)。
检查在ArcCatalog源数据
在这里,您可以看到关系类已创建。视图可以通过ArcGIS被访问,和打开的关系类的属性。右键单击关系类>属性。作为提醒,这是因为关系类必须在ArcGIS中创建,然后他们可以通过FME填充。
3)的事实,这是M:N的关系,我们需要确保一些属性存储上的功能将被写入到关系类。
起点和终点的oid,请参考各要素类初级和外键。在这个例子中,我们使用的对象ID为新创建的起点/终点OID值。这是要注意重要的是,这些新创造的价值,没有明确写入地理数据库,而是帮助FME过程的特征是如何与关系。为了这些功能存储每个要素类,我们需要添加每个要素类的AttributeManager。这允许用户创建前面提到的所需要的属性。
原产地AttributeManager参数(结构表):
目的地AttributeManager参数(地址表):
4)与主键和外键设置,现在我们可以合并使用FeatureMerger变压器的功能。这是怎么回事使用的是两个要素类之间共享的领域合并功能,在这种情况下,Structure.SiteID和Address.Remarks。
5)最后,需要另一个AttributeManager变压器,以确保特征被识别为一个要素类。这是通过设置geodb_type为“geodb_relationship”做,如果你处理的归属关系,该值将需要被设置为“geodb_attributed_relationship”。
6)最后,作家加入。正是在这里,我们直接写入关系表。为了正确地做到这一点,值我们之前设置:
Geodb_rel_origin_oid
Geodb_rel_destination_oid
Geodb_type
我们没有设置外键值(StructureEventID和AddressEventID),因为这些会通过作家填充只要上述数值也作了相应的映射。
7)运行的工作区。关系类现在应该与AddressEventID和StructureEventId外键值填充。
如果有2个要素类开始,你要插入一个新的地理数据库与关系类,1的组合:M关系的工作空间和更新M:N的关系,工作区时须携带这个任务了。此外,应该注意的是,在转换之前目的地创建的关系类的需求,通过ArcGIS的。这样的工作空间的一个例子可以在“Many2ManyAdvanced”模板中看到。
© 2019 Safe Software Inc |Legal