Skip navigation
All Places > Applications Prototype Lab > Blog > Author: apascual-esristaff

At the 2018 Esri DevSummit in Palm Springs, Omar Maher demonstrated how to predict accident probability using artificial intelligence (AI). The Applications Prototype Lab (APL) has built an iOS application allowing drivers to route around accident prone areas, suggesting the safest route available. The safest route has the lowest probability of an accident occurring on it.


Imagine that you could drive to your destination on a route that is the fastest, shortest and safest path available, knowing that the path will be clear of potential accidents, knowing that you will not become part of an accident study that month. 

Parents could choose the safest route for their teen drivers, to avoid common issues and spots on the road network that are potentially dangerous. 


This demo does not compute the AI prediction results itself but rather consumes a probability prediction that has been computed using a gradient boosting algorithm in Azure using 7 years of historical data. The demo shows a routing engine considering the accident probability as an input and it tries to route around areas with high accident probability.

In the future, the prediction will use real time inputs in its probability prediction.


Compare the screenshots below with 2 different probability inputs. The first image shows the routing information for a chosen accident probability of about 38%.



Reducing the chances of an accident to about 23% will cause the route to be longer in time and length.



Here is a video showing how decreasing the probability of accidents will return a safer route:



The application uses the ArcGIS Runtime SDK for iOS routing engine `AGSRouteTask` that considers different barriers in the form of lines and polygons. Using the generated probability lines as barriers, the routing task will generate a route around the areas of the specified acceptable accident probability. All code is available upon request, but the feature service and credentials are private at this time.


In summary, we have shown the impact of accident probability on routing computations. Using the prediction models trained by artificial intelligence using historical and current road conditions we hope that in the near future accident probabilities will become an additional input for all routing engines. 

The ArcGIS Runtime SDK for iOS makes it easy to create applications that take advantage of the iOS Core Motion Framework. As the user moves the device, we can change the orientation of the camera to pan the map toward the location the user intents to view.


The 2 videos below show the result of the using the Core Motion framework output values to change the camera position on the Runtime SceneView



A closer look, just recording the screen. We can turn off the Gyro and stop the Core Motion delegate to use touch to zoom out and pan to see the satellites from space instead of looking up from earth.


Its as simple as creating a CMMotionManager object and changing the interval where the handler will be called, we are setting the interval to 0.1, better to avoid missing a position and making the movement buttery smooth. We need to create the AGSCamera that requires a GPS position to start, I would recommend to pass you CLLocation, for the demo, we set it manually for the demo.

By calling 'startDeviceMotionUpdates, when data is available, the handler will be called with the roll, yaw and pitch

Handle Motion from device


We can set the new camera rotation using the data return from core motion after converting them to degrees (*180 / M_PI)



The camera will pan the AGSSceneView to show the features added on the Graphic Overlays. You can use this to display features around you, they don't need to be just satellites, on the AGSSceneView you can place features at any altitude you desire, including underground features.


This short blog post, shows how to use the AGSCamera and Apple's Core Motion to create a 3D with motion app on your device. 


You can download the ArcGIS Runtime SDK for iOS here

Filter Blog

By date: By tag: