# Calculate distance between two AGSPoints

521
2
04-23-2018 05:33 AM
New Contributor III

How can we calculate the distance between two AGSPoints. Previously in runtime SDK 10.x the method `

distanceToPoint` is used,

as

float len = [agsPoint1 distanceToPoint: agsPoint2];

but i didn't find any related methods in runtime SDK 100.x.

1 Solution

Accepted Solutions
Esri Contributor

Hello,

You can use `AGSGeometryEngine`'s

## distanceBetweenGeometry1:geometry2:()

for simple planar distance between two points OR

## geodeticDistanceBetweenPoint1:point2:distanceUnit:azimuthUnit:curveType:()

to get the geodetic distance.

Hope this helps

Suganya

2 Replies
Esri Contributor

Hello,

You can use `AGSGeometryEngine`'s

## distanceBetweenGeometry1:geometry2:()

for simple planar distance between two points OR

## geodeticDistanceBetweenPoint1:point2:distanceUnit:azimuthUnit:curveType:()

to get the geodetic distance.

Hope this helps

Suganya

New Contributor III

Thank you SBaskaran-esristaff‌. Finally used as below:

return [AGSGeometryEngine geodeticDistanceBetweenPoint1:point1 point2:point2 distanceUnit:AGSLinearUnit.meters azimuthUnit:AGSAngularUnit.radians curveType:AGSGeodeticCurveTypeGeodesic].distance;