Esri + Pubnub Webinar - Realtime, Serverless Geo

1007
0
08-24-2017 07:45 AM
AndyGup
Esri Regular Contributor
2 0 1,007

Contributed by Andy Gup and Nicholas Furness

On August 16th, Esri and PubNub joined forces in a webinar on realtime mapping and asset tracking. On-demand services are a hot topic, so Nick Furness and I wanted to create a demo application to explore some of the concepts involved. We covered the basics of combining ArcGIS Online with PubNub Functions to build a realtime, completely serverless proof of concept using an ArcGIS for Developer and PubNub trail account.

Check out the video below. You can find the source code and setup instructions at github.com/esri.

We used a variety of ArcGIS Online components to bring it all together including Feature Services, Optimized Routing, Service Areas (which are used as geofences), and the ArcGIS API for JavaScript. And, of course, there's a PubNub Function for handling the realtime aspects of communicating between drivers, customers, and dispatcher dashboards.

How it works

The demo consists of a Delivery Management App for monitoring delivery routes and a PubNub Function for handling realtime updates. This app is built using the ArcGIS API for JavaScript and makes use of Calcite Maps. Skip to about 18:35 in the video to see the demo in action.

The app assigns a set of deliveries to a driver and the optimized order is calculated using ArcGIS Online's RouteTask. For each delivery, a geofence is calculated using the ServiceAreaTask. These are used to alert a customer when the driver is five minutes away with their delivery. The route geometry and geofences are stored in ArcGIS Online Feature Services, and the driver is dispatched.

As the driver progresses, their updated location is posted to the PubNub Function. PubNub uses the geofences stored in ArcGIS Online to determine when the driver enters the geofence for the next delivery (e.g., is five minutes away), and the customer is notified that their delivery is about to arrive.

Delivery Demo with Realtime Events

Simulating the Driver

For the purposes of this demo, the app picks five random customers from a list of thirty. One driver is used for a route, and the driver's location is simulated (sped up significantly, of course). However, the driver simulator app posts updates to PubNub, in lieu of a real driver using a GPS-enabled app, and the PubNub Function handles the rest.

The driver's location is simulated by following the route that is returned from the Esri Route Service. In a real-world implementation, the driver might use a custom app to post location updates, capture customer signatures, and mark deliveries as completed. In addition, depending on the use-case, the driver might choose to take alternate routes, which might require a re-ordering of deliveries, but in this simple prototype use-case, we don't dig in that deep.

Voucher Code

Since this prototype uses optimized routing and service areas, both of which consume credits, we handed out a voucher for 1,000 credits during the webinar (it's mentioned in the video). These can be applied to your ArcGIS Developer account. If you use this voucher, be sure to redeem it before August 29th at 8am Pacific Time and the credits are good until March 1, 2018.

References

ArcGIS for Developers Program (Free)

PubNub Free Trail

About the Author
Sr. Product Engineer - ArcGIS API for JavaScript.