Satellite Viewer using the ArcGIS Runtime SDK for iOS and Core Motion

06-08-2017 01:25 PM
Esri Contributor
2 0 322

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

About the Author
App Developer at Esri