erodenberg-esristaff

ADDING ESRI'S WORLD TRAFFIC SERVICE TO A WEB APPLICATION - Updated 7/22/2020

Blog Post created by erodenberg-esristaff Employee on Apr 8, 2016

First, thanks to Peter Gamberg on the State and Local Government Team for helping me by updating the steps in the workflow.  It has been several years since I wrote this and I knew the workflow had changed based on updates made to the Esri Developers site but my priorities have been elsewhere.  

 

 As you build more and more ArcGIS Online web applications for your organization, you'll likely need to include one of Esri's Premium Services, such as Live Traffic, especially if your organization is a State Department of Transportation. While Live Traffic does not cost credits, it does require a named user to access the premium content. You, of course, know this because when you launched the application, which you tirelessly spent all that time configuring, you hit the snag where the app requires the user to sign in. So how are you supposed to deploy a public app with traffic cameras, weather, and live traffic if your app requires a login?

 

You could provide an access token and embed it in your application, but this requires custom development, and you must host the application yourself. Also, this method creates a security risk because your token could be hijacked and used without you ever knowing. 

 

A more straightforward solution is to create a proxy service configuration for the premium service of your choice. A proxy service allows you to encode and manage your credentials inside a service URL. Additionally, proxy services support rate-limiting. Proxy services allow you to make the Esri World Geocoding Service available to an end-user for batch Geocoding or other operations which do consume credits. However, it protects you because you can specify the rate at which addresses can be batch geocoded, preventing runaway usage while allowing the public the access they need.

 

Here is how it works.

  1. Log in to developers.arcgis.com with your ArcGIS Online credentials
  2. Register your application by choosing New Application
  3. Provide the Application Details
  4. Click on the Services Tab
  5. Scroll down to the Service Proxies area.
  6. Select the service you wish to proxy and enter a rate limit for the number of requests you want to allow over a given period.
  7. Copy the newly created proxy URL and add it to the webmap that your application is consuming. Remove the original service if it exists and save the webmap.
  8. Log out of all web sessions using your ArcGIS Online credentials or use Incognito Mode on your browser to test that your app opens without challenging you for credentials. (This is a quick trick to allow you to open the browser with a cleared browser cache.)  
  9. Open your web application and bask in the glory of your app opening with Premium Services that don't prompt your public users for an ArcGIS Online Username and Password. 

 

Try it live

 

Besides Traffic and Batch Geocoding you can also proxy the following services:

 
 

Service

Proxy Value

Geocoding

geocode

Geoenrichment

geoenrichment

Routing

route

Rout@@ing (Async)

asyncRoute

Closest Facility

closestFacility

Closest Facility (Async)

asyncClosestFacility

Service Area

serviceArea

Service Area (Async)

asyncServiceArea

Location Allocation

asyncLocationAllocation

Vehicle Routing Problem

syncVRP

Vehicle Routing Problem (Async)

asyncVRP

World Traffic

traffic

Elevation

elevation

Elevation

elevationSync

Hydrology

hydrology

Outcomes