span8
span4
截至公告日由谷歌在2018年12月11, Google Fusion Tables and the Fusion Tables API will be turned off on December 3, 2019.Fusion Tables的支持将从FME服务已被关闭之后被去除。对于如何将数据迁移出使用FME谷歌融合表的,请参阅博客文章 7+ Google Fusion Tables Alternatives。
请注意,这篇文章将不会被更新。要使用谷歌的Fusion Tables不再起作用后,这些工作区,改读/写器,以谷歌表或类似的产品。
Note: This tutorial requires aGoogleaccount and Microsoft Excel.
使用标准目录观看配置,FME Server将每一个被监视的文件(或文件夹)被修改时触发通知。这可以在服务器上创建处理的过载。本教程提出了一种方法来使用空闲时间延迟最优的方式处理这些迁移。
在以下示例中,Excel电子表格被存储在监视文件夹。当电子表格被修改,通过FME服务器和内容生成通知(即文件名,时间戳)存储在数据库表中。该表是由一个工作区的运行检查的时间表,并且当期望的时间量已过去对于每个修改的文件,该数据会自动在云备份到谷歌融合表。
directory-watch-idle-delay.zip
导航到安装FME Server或你自己的机器提供了FME Server位于同一网络上的计算机上的文件系统。创建一个名为“资源”的新文件夹,并从所连接的下载复制Project_Inventory.xlsx文件到新文件夹。右键单击资源文件夹的任何位置,然后单击属性。在共享选项卡上单击高级共享,然后启用共享该文件夹,确保权限设置为写,然后单击确定。复制UNC网络路径(例如\\ KC-LS-WINDOWS \资源),我们将需要这在下一步并关闭属性窗口。此外,根据您的计算机中的共享设置,您可能需要点击分享...在资源属性对话框按钮,然后单击共享。
创建 a shared folder containing Project Inventory.xlsx, ensure permissions are set to full
登录到您的FME Server和在通知下侧菜单栏上选择出版物。单击新建,并给您的出版物名称“sync_tool”,并添加一个新的话题,发布到名为‘sync_tool’。选择目录看协议和目录 to Watch choose 'Specify a location', and paste the UNC Network Path we copied in the last step.Monitor MODIFY operations (remove CREATE and DELETE).Finally, set the Poll Interval to 1 Minute, you can leave it as the default, but for testing purposes a lower interval will be quicker to debug.Click OK to create the publication.
创建 the new Directory Watch publication in FME Server called sync_tool, set it to watch your Resource directory.
Open theproject_inventory_to_map.fmw(Workspace #1)in FME Workbench.This workspace writes Excel data to a Google Fusion table stored in the cloud.For more information on Google Fusion Tables refer to theuser documentation。
In the User Parameters in the Navigator pane, under Published Parameters, double click on the [SourceDataset_XLSXR], set the path to "\\YourUNCPath\Resource\Project Inventory.xlsx", make sure you include the quotations.
Double-click on the SQLExecutor to modify the parameters.We will need to login to our personal Google account and authorize FME.To do this, select Parameters in the SQLExecutor, in the Google Fusion Table Spatial Parameters dialog box, click on the (...).In the OAuth authentication window, log in using your own Google account credentials to manage Fusion Tables and click Allow.You now have a Refresh Token in the Google Fusion Tables Spatial Parameters dialog, copy this token to avoid re-authentication in later steps.Click OK to exit the SQLExecuter parameters
Double-click on the [GoogleToken] User Parameter and paste in the Fusion Table Refresh Token to connect to your own account.
project_inventory_to_map.fmw (workspace #1) workflow
Publish to FME Server, create a new repository called Project_Inventory, then register with the Job Submitter Service.(Note: Ensure that you uncheck Upload Data Files so that the Excel file is not uploaded to the Server)
In FME Workbench openproject_inventory_status.fmw(Workspace #2), this workspace runs when a Modify trigger is sent by the Directory Watch protocol.Details from the notification message (i.e.filename, timestamp) are stored in a database, which in this case will be a Google Fusion Table.
This workspace was set up with a User Parameter called GoogleToken to speed up the process of authentication in the SQLExecutor and the Writer, it is the same process as the last step.Click on the GoogleToken Published Parameter and paste your Refresh Token.
Publish the workspace FME Server, in the Project_Inventory repository, and register the workspace using the Notification Service.Click Edit and choose sync_tool for Subscribe to Topic.(Note: You may receive a warning message - this workspace uses custom formats, which will need to be provided to FME Server - click yes to accept.)
project_inventory_status.fmw (workspace #2) workflow
In order for the workspace to run with a custom transformer on FME Server, we will need to upload the custom transformer.In FME Server, go to Resources and navigate to the Formats folder within the Engine folder.Click Upload and browse to the DIRECTORY_WATCH_READER.fds, which is located in the folder that was downloaded at the beginning of this tutorial.
Upload the DIRECTORY_WATCH_READER.fds to the Formats folder in FME Server
Back in FME Workbench openproject_inventory_sync.fmw(Workspace #3), this workspace is used to check the database(Google Fusion Table) for modified files and send them to be processed when necessary.
In the User Parameters, double click on [GoogleToken] and paste your refresh token.In the FMEServerJobSubmitter connect to your FME Server.Then select the Project_Inventory repository and select the project_inventory_to_map.fmw workspace, click the refresh icon in the lower left hand corner, to bring in the parameters from project_inventory_to_map.fmw.This will enable theproject_inventory_to_map.fmw(Workspace #1)to run onceproject_inventory_sync.fmw(Workspace #3)has run.
Publish to FME Server in the same repository and register with the Job Submitter.
project_inventory_sync.fmw (workspace #3) workflow
In FME Workbench openDB_Loader.fmw(Workspace #4), this workspace creates two tables in your Google Fusion Database.
In the Navigator pane under User Parameters, double click on [SourceDataset_XLSXR] and browse to the shared Resource folder and add the Project Inventory.xlsx file
Next, double click on [SourceDataset_CSV] and browse to the CSV file called project_inventory_file_status.csv that came with the file download.
Then update the [GoogleToken] just as before, then run the workspace.After running your translation, check in your Google Drive account to ensure the workspace ran correctly, you should see two files, Project Inventory and project_inventory_file_status.
DB_loader.fmw (workspace #4) workflow.创建s two Google Fusion Tables
The last step is to setup a schedule to check our tracking database.This can be set to run every few minutes.This schedule will runproject_inventory_sync.fmw(Workspace #3), which checks the tracking database for the last modified time.If it is greater than the idle time set within the workspace, the data is migrated.
In FME Server, go to the Schedules page and click New to create a new schedule named project_inventory_sync and create a new Category called Project_Inventory.立即检查运行,然后重复每一集 2 Minutes or however often you would like it to repeat.
Then set the Repository to Project_Inventory and select theproject_inventory_sync.fmw(Workspace #3)and click OK to set up the schedule.A Published Parameters section will be exposed, you can adjust the Seconds to Wait if you like, this is the desired amount of time to wait after the Excel file has been updated and is idle.Once this condition is met, the data will be synced to the Google fusion table.Also, ensure that your Refresh Token is correct.Click OK to start the schedule.
In FME Server, click on Notifications, then click the Topic Monitoring Tab.For Topics to Monitor, add sync_tool.This will send a notification each time the file is modified.Ensure this page is left open for Topic Monitoring to continue.
At this point, all the necessary steps are in place to have an optimized backup system for your spreadsheet data.To test this try the following steps:
Open Google Drive and open the two Fusion Table files you created, Project Inventory and project_inventory_file_status.To do this, right click on the file, then Open With > Google Fusion Tables.
Open the Excel document in Excel (project_inventory.xlsx) and enter a new row:
100007 repair manhole replaced 49.2755567 -123.0576200
Save the excel file, ensure it is saved to the shared Resource folder and the file extension is .xlsx.This will trigger the Directory Watch protocol to post a Modify to the sync_tool topic.If you open the Jobs up in a new FME Server window, the project_inventory_status.fmw workspace will have run, then depending on your schedule, the project_inventory_sync.fmw will run, depending on how the schedule lined up to your update, you might have to wait for the schedule to run twice in order for the Google Fusion Table to update.Wait up to five minutes for this process to run through depending on how your schedule was set up and the Seconds to Wait parameter was set to.After the allotted time has passed refresh both Google Fusion Tables to see the updates.
Topic Monitoring in FME Server when the Project Inventory.xlsx file is modified in Excel
Using Idle Time Delay is useful for keeping a backup of your documents while you are updating them.The workspace only runs when it detects a change after a certain period of time in your local document, this frees up valuable server engines, only running the workspace when required instead of on a schedule.Creating a separate status table is also useful for ensuring that the updates to the local file were expected, especially when the file is shared among several users.
Tutorial Overview: Directory Watch|Previous: Directory Watch Publisher| Current: Directory Watch Publisher with Idle Time Delay (Advanced)
©2020安全亚搏在线软件公司|法律