span8
span4
Here's how to join or merge two sets of data together by a common field -- no coding or scripting necessary. FME's DatabaseJoiner transformer can be used with many of the formats supported by FME. This demo will join CSV and database data based on address values. You'll see how to set up the data for joining using additional transformers, plus get tips for maximizing performance.
目标是将犯罪信息的CSV数据与道路信息数据库相匹配,以便我们可以确定哪些道路表现出最犯罪的活动。DatabaseJoiner将用于执行此任务,并且将输出写入Excel。
Note: This video uses FME 2016, the interface might vary. Here's how to join or merge two sets of data together by a common field -- no coding or scripting necessary. FME's DatabaseJoiner transformer can be used with many of the formats supported by FME. This demo will join CSV and datbase data based on address values. You'll see how to set up the data for joining using additional transformers, plus get tips for maximizing performance.
JoinCSVWithDatabase.zip(contains both starting and finished workspaces with data)
A starting workspace has been provided which reads the CSV data, and formats the Block attribute so it matches the formatting of the HBlock attribute in the Roads table.
1. Open starting workspace.
Open StartingWorkspace.fmw, In this workspace, a StringReplacer has been used to replace XX in the Block attribute with 00. A StringCaseChanger changes the Block attribute from uppercase to mixed case.
Starting workspace
2. Add a DatabaseJoiner.
Connect it to the StringCaseChanger. Open the properties of the DatabaseJoiner and connect to the database.
PostGIS connection details:
Select the Roads table in the public table
Select the feature attribute from the incoming CSV features, Block, and the corresponding PostGIS table attribute, HBlock, that will be used to find matches. Matches are made when the values of the CSV attributes equal the values of their corresponding PostGIS table fields.
For Fields to Add, select Type.
Open the Optimize panel on the DatabaseJoiner: Add a Prefetch Query to load all of the records from the database table into a
select * from public."Roads"
由于预取查询,DatabaseJoiner is not required to read from the database for each record. This can improve the performance, and reduce the number of queries back to the database.
使用databasejoiner并使用hblock连接块。然后将“正面查询”设置为“公共公共”。“道路”
3. Add an Inspector
将DatabaseJoiner连接和检查器以确认已添加道路类型属性。
Output of the dataset with the joined fields in the Data Inspector
An AttributeFilter can be added to filter by the "type" attribute, and so on.
或者,可以在DatabaseJoiner之后添加Excel Writer,使用工作表名称从“类型”属性中获取其值。这将导致Excel文件列出犯罪,其中每个道路类型都有一个选项卡。
Data Attribution
The data used here originates from open data made available by theCity of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
© 2020 Safe Software Inc |Legal