ArcGIS Runtime SDK for macOS

Distance measurement analysis

Description

This sample demonstrates how to measure 3D distances between two points in a scene.

How it works

Choose a unit system for the measurement in the UI dropdown. Single tap any location on the screen to set the start point of measurement. Tap elsewhere to set the end point of measurement. Single Tapping any new location will start a new measurement.

Code steps:

  1. Create an AGSAnalysisOverlay and add it to your scene view's analysis overlay collection: sceneView.analysisOverlays.add(analysisOverlay).
  2. Create an AGSLocationDistanceMeasurement, specifying the startLocation and endLocation. These can be the same point to start with. Add the analysis to the analysis overlay: analysisOverlay.analyses.add(locationDistanceMeasurement). The measuring line will be drawn for you between the two points.
  3. The measurementChangedHandler callback will fire if the distances change. You can get the new values for the directDistance, horizontalDistance, and verticalDistance from the parameters passed to the callback closure. The distance objects contain both a scalar value and a unit of measurement.


In this topic
  1. Description