span8
span4
上面的视频覆盖理论覆盖介绍工作与地理数据库关系类,示例涵盖在这篇文章。
地理数据库附件是附加信息连接到特征在特定的文件的形式的方式(即图像,PDF,或文本文档)。由于ArcGIS documentation提到:
“举个例子,如果你有代表的建筑特色,你可以使用附件中添加从几个角度拍摄建筑物的多张照片,包含了建筑的契约和税务信息的PDF文件一起。”
您可以在一个或多个文件附加到功能,然后检索使用的查询工具在ArcGIS的信息。
* The ESRI File Geodatabase reader/writer used/mentioned in this article requires a licensed version of ArcGIS.对于 more information on required ArcGIS license levels, please seeRequired ArcGIS License Types for FME Geodatabase Formats.
Attachments and FME
因为附件由关系类处理,FME能够容易地创建这种连接的。然而,附件表已在ArcGIS中创建事前。关键是要读取的文件的要附加到的属性和写入附件表属性映射为数据字段的内容。关系类必须在ArcGIS中创建事前。关键是要读取的文件的要附加到的属性和写入附件表属性映射为数据字段的内容。
一个AttributeFileReader变压器或数据文件阅读器可以被用来读取文件的内容到一个属性。在数据文件阅读器的情况下,一定要设置读者参数“读取整个文件一旦”以Yes.reader可以用来读取文件的内容到一个属性。在数据文件阅读器的情况下,一定要设置读者参数“读取整个文件一旦”为是。
这次演习遵循将演示如何写一个关系类,而添加附件。
attachments.zip
Note: the template files provided in the download will allow us to write to a geodatabase that already has a feature class, attachment table, and the relationship set up.Normally this would have to be set up in ArcGIS beforehand.When using an XML Template file, the workspace will only be able to run once, all future translations will require the template to be removed from the writer.
在下图中,我们看到一个包含射击馆,社区中心,和库数据在数据检查我们的源文件GML的可视化。亚搏国际在线官网
Fire Halls, Community Centres, Libraries in geographic markup language (GML)
在下图中,我们看到的是将作为附件的照片和PDF文件所在的系统路径的可视化。
Paths to photograph and pdf file attachments in the PointsOfInterest folder.
对于这个练习,一开始的工作区已提供。
你会立即注意到工作区已经部分成立。源和目标架构对象已经到位,并准备从读/写。也有一些变压器已经到位映射Reader和Writer架构。唯一缺少的东西是建立关系所需的变压器 - 增加他们对这项工作的主要任务。但是,我们将通过一个数字,已经建立并复制到书签预定变压器得到帮助。
Predefined transformers
1.Download Attachments Folder
如上所述,关系类不能通过FME创建。因此,有必要确定运行转换之前您的功能之间的关系。对于这个演示,目的地地理数据库与所需的空要素类和定义的关系已经提供(请参阅attachments.zip在下载部分)。下载并解压缩这个zip文件夹,因为它不仅包含所需目的地地理数据库,同时也包含了将用作在工作流程中的附件所需的文件。亚搏在线
2.Read Source Data
射击馆,社区中心,图书亚搏国际在线官网馆和几何形状是从使用GML读者兴趣地理标记语言文件的源点读。
目录和文件路径名读者用来读取系统路径将被作为附件的图像和PDF文件。虽然读者已经被添加为起始工作区的一部分,确保每个读者源参数是指向正确的数据集。
3.Setup Source Attributes to Match Destination Schema
一些额外的工作,需要以修改属性为每个数据集来源,使它们匹配目标架构。
对于FireHalls,此装置重命名与AttributeManager以下属性:
Input Attribute | Output Attribute | Attribute Value | Action |
Name | Description | Rename | |
HallNumber | Name | Rename | |
Address | Street | Rename |
Rename FireHalls attributes
对于CommunityCentres,此装置修改与AttributeManager以下属性:
Input Attribute | Output Attribute | Attribute Value | Action |
CentreName | Name | Rename | |
CentreAddress | Street | Rename | |
CentreURL | 卷筒纸site | Rename | |
DocumentName | Description | Rename | |
PostalCode | unknown | Set Value |
Rename CommunityCentres attributes
对于Libraries,此装置修改与AttributeManager以下属性:
Input Attribute | Output Attribute |
Attribute Value | Action |
LibraryName | Name | Rename | |
LibraryAddress | Street | Rename | |
LibraryURL | 卷筒纸site | Rename | |
DocumentName | Description | Rename | |
PostalCode | unknown | Set Value |
Rename Libraries attributes
4.Add Relationship Related Attributes
FME需要被告知功能参与关系类。要做到这一点,我们将使用AttributeCreator变压器。这种变压器可以在“变形金刚用”书签中找到。都需要给出AttributeCreator的两个实例,有两个数据流(兴趣点,并在附件)。
复制/移动该变压器为两个名为“4.添加关系相关的属性”的浅棕色的书签。对于兴趣的点(FireHalls,CommunityCentres和库特征类型亚搏国际在线官网),所有三个现有AttributeManager变压器连接到新的AttributeCreator。对于路径的连接文件(PATH特征类型),只需连接目录和文件路径名读取器到第二AttributeCreator。
Workspace after adding and connecting the predefined AttributeCreator.
打开属性对话框为AttributeCreators之一,你会看到它所做的就是一套名为geodb_feature_has_relationships的格式属性。属性,geodb_feature_has_relationships设置为yes,是需要告诉FME,这些功能参与关系的所有。
Attribute geodb_feature_has_relationships set to yes
各组特征还需要一个ID号。假设一个已经不存在,我们可以创建一个与计数器变压器。同样,我们需要每一套功能一个实例,并且已经有在“变形金刚用”书签预先定义的变压器。从收藏中移动/复制计数器变压器和从每上一步AttributeCreator转换后连接它的一个实例。检查计数器参数,你会发现它创建一个名为geodb_oid的属性。
Counter creating an ID attribute, geodb_oid
5.Connect Schema
在这一点上,特点是准备写的地理数据库,这样你就可以创建现有AttributeRenamer变压器和PointsOfInterest__ATTACH特征类型从柜台变压器连接。
Complete data flow
打开该AttributeRenamer_POIType变压器参数对话框。在这里,我们需要重命名fme_feature_type属性POIType,这保证了功能的名称为源要素保持在一个属性的原因。在这种情况下,我们将有Firehalls,社区中心及图书馆还。亚搏国际在线官网参数应设置如下:
6.Add Relationship Related Attributes
现在,我们需要定义两组特征之间的关系,我们通过创建出发地和目的地的ID号码做到这一点。同样,我们需要每一套功能一个实例,并且已经有两个预先定义的变压器,我们可以使用。移动两个AttributeRenamer变压器(即AttributeRenamer_Origin和AttributeRenamer_Destination)从“变形金刚使用”书签到黄色,中心书签。建立从利息(FireHalls,CommunityCentres和库特征类型)柜台AttributeRenamer_Origin的指向A亚搏国际在线官网ttributeRenamer_Destination重复的连接,另一个是路径计数器:
Workspace after adding relationship related attributes.
检查每个AttributeRenamer的参数。你会看到,每个被重命名新创建的ID到任何一个始发地或目的地的ID。这是FME将使用写关系类。
7.Build Relationship Information
添加FeatureMerger变压器。这是怎样的关系将建成。起源AttributeRenamer连接到请求者端口和目标AttributeRenamer给供应商。打开该FeatureMerger参数对话框。设置请求者属性名称和吃晚饭plier attribute to be path_rootname.
The result of this is that data gets merged where the filename (path_rootname) of the attachment matches the name of the Point of Interest feature (Name).
对于 example, if I have a point of interest called “Big Tall Statue” (Origin ID = 13) and there is a file named “Big Tall Statue.jpg” (Destination ID = 22) then the result will be a single feature (“Big Tall Statue”, Origin ID = 13, Destination ID = 22) that defines a relationship between those features.
When writing this to the Relationship Class, it will define the relationship between these features in the PointsOfInterest and PointsOfInterest_ATTACH tables.
The other outstanding issue to take care of is the case where there are multiple attachments for a particular point of interest.So, while still in the FeatureMerger parameters dialog, change “Process Duplicate Suppliers” to Yes and enter Docs as the list to create.
FeatureMerger parameters
Now when the workspace is run, for features with multiple attachments, multiple files are stored in a list, like so:
Docs{0}.path_filename
Docs{0}.geodb_rel_destination_oid
Docs{1}.path_filename
Docs{1}.geodb_rel_destination_oid
What we now need to do is explode this list into individual features – so that there is a relationship record for each attachment – and this is done with a ListExploder transformer.Insert a ListExploder transformer after the FeatureMerger and connect the Merged output port of the FeatureMerger to the input of the ListExploder.Open the ListExploder parameters dialog and select Docs{} as the list to explode:
ListExploder parameters
Each feature that gets sent to a FME Writer should have an attribute indicating the geometry type.In most cases you – the user – never need to know about this attribute and don’t need to set it.However, here these features will be currently flagged as point features (i.e.points of interest) and we need to tell FME they are actually non-geometry, relationship features.So, add an AttributeCreator transformer after the ListExploder and connect the AttributeCreator to the Elements port of the ListExploder.
Open the parameters dialog of the AttributeCreator and use it to create a new attribute called geodb_type.It should be given a value of geodb_relationship.This will tell FME to write these to the Geodatabase as relationship features.
AttributeCreator parameters following the List Exploder.
You can now connect the AttributeCreator_3 to the PointsOfInterest__ATTACHREL Writer feature type.
8.Setup the fields in the Attachment Table
At the moment we’re writing a relationship between features, but the destination features (attachments) are currently just a reference to a file, not the file itself.We need to use these references to read the attachment file contents.A pre-defined section of workspace will do this for us.Look for the ‘Setup the fields in the attachments table’ bookmark.
Examine what these transformers are doing.The AttributeCopier is doing some basic schema mapping while the StringConcatenator is setting an attribute to tell ArcGIS about the type of file being attached.Finally, the AttributeFileReader reads the content of the attachment, using the filename obtained from the original PATH Reader.
Connect the contents of this bookmark into the main workspace (i.e.into the connection between the attachments Counter and the Writer feature type (PointsOfInterest__ATTACH)).Remove any existing connection to PointsOfInterest__ATTACH.
9.Write Relationship Data & Attachments
At this point, we should check (in the Navigator window) that the transaction type is set to Edit Session.
Note: the template files provided will allow us to write to a geodatabase that already has a feature class, attachment table, and the relationship set up.Normally this would have to be set up in ArcGIS beforehand.When using an XML Template file, the workspace will only be able to run once, all future translations will require the template to be removed from the writer.
Relationship classes must be written to in an edit session.Now save and run the workspace (make sure ArcGIS and Data Inspector is closed to avoid any data lock issues).When you inspect the PointsOfInterest features in ArcGIS (remember they are in the Feature Dataset called City) query them with the HTML PopUp tool.
PointsOfInterest features in ArcGIS queried with the HTML PopUp tool
I have tried the tutorial and Im testing it with our data and the wrong photos are being attached to the features.any idea what could the issue be , is there a sort order for the workflow .
any help will be appreciated
Thank you
Hi@adi
Apologies for the delay in getting back to you.I personally have not tested building relationships when the relationship is based on GlobalID's.I suspect if this functionality is supported it will be in FME 2019.
In terms of the data and attachments being mixed up, this suggests that the Joining of your two features is not quite configured correctly.If you can try and test with a single attachment and its target feature, and try to get them to join correctly(this is how the relationship will be populated) that should solve the issue.这发生在FeatureMerger。也不e, what type of relationship class is present?As outlined in the following article, some relationship classes do not require writing to the Relationship table.See Relationship Background section here:https://knowledge.safe.com/articles/28340/working-with-geodatabase-relationship-classes-atta.html
If still having trouble, if you are able to post a sample of your data/workspace I could take a look.
©2020安全亚搏在线软件公司|法律