Skip To Content ArcGIS for Developers Sign In Dashboard

ArcGIS Runtime SDK for Qt

Shortest distance (online)

Find the shortest distance between a polyline and a point. Draw a red polyline with left-clicks of mouse. Vertices are added until you double-click to end the polyline. The next left-click marks a point in blue. The distance measured is between the polyline and the point. Your application can find the shortest distance between two geometries in map units with GeometryEngine::distance(). Using another approach, this sample measures the length along a geodesic line using GeometryEngine::getNearestCoordinate(). It returns the nearest coordinate of the polyline to the point, and can return the distance in various units. A line is drawn between the point and the nearest coordinate on the line. Then the sample calls GeometryEngine::geodesicLength() to get the distance in miles.