FME Version
Files
Introduction
The EsriArcGISOnlineConnector transformer enables users to access the content they have stored online. It can be used to upload, update, download, delete, or list information about items from a user's Esri ArcGIS Online content. This transformer uses either an Esri ArcGIS Online Connection or an Esri Portal Connection for authentication.
The EsriArcGISOnlineConnector is available on the FME Hub and can be used with FME 2019.0 (Build 19231) or higher.
Requirements
A valid Esri ArcGIS Online account is required to access ArcGIS Online. Obtain a free trial account.
Step-by-Step Instructions
This tutorial provides step by step instructions on how to manage data using the ArcGISOnlineConnector. This tutorial gives two examples of how the ArcGISOnlineConnector can be used. However, the ArcGISOnlineConnector has many functions that are listed in the documentation.
The examples in this tutorial include downloading content from ArcGISOnline, such as shapefiles to store files locally. This could be useful for backing up data from ArcGIS Online. Additionally, more transformers could be used to send these files elsewhere. The files could be emailed using the Emailer transformer or uploaded to an FTP using the FTPCaller.
Another useful example will include how to publish files to ArcGIS Online using the ArcGISOnlineConnector. These files can then be shared using ArcGISOnlineConnector as well.
Part 1: Uploading and sharing files using the ArcGISOnlineConnector
This example shows how to upload shapefiles using the ArcGISOnlineConnector and share them with other users. The ArcGISOnlineConnector does require that shapefiles are zipped before uploading. FME can zip up any file directly in the writer.
Before beginning, download the Zipped Shapefiles file located in the Files section. Then, unzip the file so the Zipped Shapefile folder is visible.
1. Open FME Workbench
First, open up FME Workbench to a blank workspace.
2. Add a Directory and File Pathnames Reader to the canvas
Add a Directory and File Pathnames Reader to your canvas by clicking on the canvas and typing “Directory and File Pathnames”. The Directory and File Pathnames Reader will read in the Pathnames of the files we are uploading. Select the Zipped Shapefiles directory available for download at the top of the page. Unzip the file to get access to the Zipped Shapefiles folder.
3. Add an ArcGISOnlineConnector
Next, add the ArcGISOnlineConnector to the canvas. Connect the ArcGISOnlineConnector to the Directory and Filenames Reader.
Click on the cogwheel on the ArcGISOnlineConnector to configure its parameters. Find the section that says ArcGIS Connection and click the down arrow to view your options.
If you have previously set up an ArcGIS Online or Portal connection, you can select it here. If you need assistance creating a connection to Portal please see How to create an FME Web Connection for Esri ArcGIS Portal Feature Service (OAuth 2.0).
If you do need to create a new ArcGISOnline connection, you can create a new connection by selecting Add Web Connection… Next, create a name for your connection and select Authenticate. Enter your ArcGISOnline username and password and select Sign In.
In the Request section of the transformer, find the field action and select Upload.
In the Data Source section, select the dropdown arrow beside File to Upload, find Attribute Value and then select path_unix (if you are on a mac) or path_windows (if you are on a windows machine).
In the Metadata section, find the Title field and select the attribute path_filename. In the Item Type field select Shapefile. Then, in the Tag field write bikepaths.
Find the Content Destination section. Here a content folder can be selected in FME. For now, leave this at the default to upload files not in a specialized folder in ArcGISOnline.
Click OK to close the parameters dialog.
4. Run the Workspace and Inspect the results.
With Feature Caching enabled, click Run, to run the workspace. Once the workspace has completed click the green magnifying glass on the Output of the ArcGISOnlineConnector to inspect the output. This will show the attributes in the Visual Preview window. Find the _private_url attribute, then copy and paste it into a browser window. This proves that the shapefile has been successfully uploaded to ArcGIS Online.
5. Add an ArcGISOnlineConnector
In FME Workbench, add a new ArcGISOnlineConnector and attach it to the existing ArcGISOnlineConnector. This new ArcGISOnlineConnector will be used to share resources with the organization.
Open up the parameters. Find the ArcGIS Connection field and select the same connection used in the first ArcGISOnlineConnector.
Find the Action field and select Share. Next, find the Path field and select the attribute _id. Finally, find the Share Level field and select Organization.
Select OK to close the dialog.
6. Run the workspace
Run the workspace again. Once the workspace has completed click the green magnifying glass on the Output of the ArcGISOnlineConnector_2 to inspect the output. This will show the attributes in the Visual Preview window. Find the _private_url attribute, then copy and paste it into a browser window.
Scroll down the page and find the Share section. Here you should see that the shapefile is now shared with your organization.
Save and close the workspace.
Part 2: Using the ArcGISOnlineConnector to download all shapefiles stored in ArcGIS Online
1. Open FME Workbench
First, open up FME Workbench to a blank workspace.
2. Add a Creator to the canvas
Add a Creator to your canvas by clicking on the canvas and typing “Creator”. The Creator will be used to kick start the workflow.
3. Add the ArcGISOnlineConnector
Next, add the ArcGISOnlineConnector to the canvas. Connect the ArcGISOnlineConnector to the Creator.
Click on the cogwheel on the ArcGISOnlineConnector to configure its parameters.
Find the ArcGIS Connection field and select the same connection used in Part 1.
After your connection has been selected. Modify the Attributes to Add and add the _item_type attribute. This will expose the file type attribute which can be used to filter the results of the ArcGISOnlineConnector. Select OK to exit the Attributes to Add dialog.
Select OK to exit the ArcGISOnlineConnector Parameters Dialog.
4. Run the translation and inspect the output
Run Workspace to run the translation. Click on the Output button to view the data output from the ArcGISOnlineConnector.
5. Add a Tester
Add a Tester to the canvas. Connect the Tester to the ArcGISOnlineConnector.
Click on the cogwheel on the Tester to open up the parameters. Select the Left Value, find Attribute Value, then select _item_type.
Then, in the Right Value, find Cached Values (2020.1+) and select Shapefile. If you are using an older version of FME, type in Shapefile.
6. Add an ArcGISOnlineConnector
Add another ArcGISOnlineConnector and attach it to the Tester.
Open up the ArcGISOnlineConnector_2. Set the Authentication by selecting an ArcGISOnline Connection or Portal. Next, select the Download action. The Content Source should be User and the Path should be set to the Attribute _Id.
Under the Destination section, set the Download as parameter to File. Then, select a Download To Folder.
7. Run the Translation and View the Results
Click Run, to run the final step of the translation. This will download all your shapefiles to the folder selected. Open the folder and find the files downloaded from ArcGIS Online!
Data Attribution
The data used here originates from data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.