Using the ArcGISOnlineRouter Custom Transformer

Evie Lapalme
Evie Lapalme
  • Updated

FME Version

Introduction

The ArcGIS Online (AGOL) Routing Service is used to find the best way to get from one location to another or to visit several locations. Check out some of the other ArcGIS Online custom transformers here: Getting Started with ArcGIS Online Custom Transformers.

 

What is ArcGIS Online?

ArcGIS Online is Esri’s cloud-based mapping software that lets you build interactive web maps. They provide analysis tools, such as the Routing Service, to gain location intelligence. ArcGIS Online enables you to work effectively across your organization by collaboratively building and using maps that you can share within your organization or publicly. 

 

Parameters of the ArcGISOnlineRouter Custom Transformer

The ArcGISOnlineRouter custom transformer accepts lines connecting the starting points to destinations as its input. Uses ArcGIS Online web connection and must specify an ArcGIS Online Server to use.

 

Requirements

  • ArcGIS Online Account with available credits

 

Step-By-Step Instructions

1. Create a Workspace
Open FME Workbench and select Blank workspace to begin building your workflow on an empty canvas.

2. Start Your Workflow
Either read in your data using a reader or a FeatureReader, or create your own data in the workspace directly. We will be creating our data within FME using the GeometryReplacer in conjunction with the Creator and the FromToBuilder. Skip this step if you are using your own data that is prepared into line segments. 

Add a Creator to the canvas, then connect a GeometryReplacer. In the GeometryReplacer parameters, set the Geometry Encoding to GeoJSON, then for Geometry Source, paste in the following:

{"type":"Point","coordinates":[-123.117428,49.279904]}


Duplicate the GeometryReplacer four (or more) times, connecting them to the Creator, then paste in the following for Geometry Source:
GeometryReplacer_2

{"type":"Point","coordinates":[-123.103609,49.265511]}


GeometryReplacer_3

{"type":"Point","coordinates":[-123.102751,49.281192]}


GeometryReplacer_4

{"type":"Point","coordinates":[-123.088846,49.277496]}

image.png

Next, add a CoordinateSystemSetter to the canvas and connect it to the GeometryReplacer. In the parameters, set the CoordinateSystem to LL84. You will have to repeat this step for each point.

image.png

To finish creating the line segments of our network, we’ll use the FromToBuilder, which is a custom transformer available from FME Hub. Connect some points to the “From” input and some points to the “To” input. 

image.png

This should form a network that looks something like this in the Visual Preview if you added all four points. 

image.png
3. Add the ArcGISOnlineRouter
Add an ArcGISOnlineRouter custom transformer to the canvas and connect it to the FromToBuilder.  Make sure that your parameters retain the default values to return all outputs, and fill in the web connection in the next step.

image.png

For more information on the parameters of this transformer please see the documentation.


4. Using the ArcGIS Online API
Select “Add Web Connection” from the drop-down of the AGOL Web Connection highlighted in red. Then give the connection a name and select “Authenticate” at the bottom. This will bring you to the authentication web connection page and prompt you for your username and password. This is needed because this service requires credits to complete the process.
image.png


5. Run the Workspace and View the Output
Run the workspace with Feature Caching Enabled, then view the output in Visual Preview. You will have four outputs from the ArcGISOnlineRouter transformer: 

  • Lines: retaining original geometry and counting features tagged with their corresponding RouteID.
  • Routes: provides total kilometers, total miles, total travel time (in minutes), stop count (including the starting point), and route ID.
  • Nodes: provides distance to next node, driving directions, time to next node (in minutes) route ID, and node ID.
  • <Rejected>: Input features are output via this port if the API calls fail. Any error message is stored in the fme_rejection_message attribute.

Routes

image.png
Nodes

image.png

Final Workspace

1-6.jpg

 

Additional Resources

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.