Skip to content

Commit c1f654c

Browse files
committed
distance haversine line method
1 parent 5299112 commit c1f654c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/mil/nga/sf/util/GeometryUtils.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,19 @@ public static double distanceHaversine(Point point1, Point point2) {
153153
return GeometryConstants.EARTH_RADIUS * c;
154154
}
155155

156+
/**
157+
* Get the distance in meters between the end points of a line in degrees
158+
* using the Haversine formula
159+
*
160+
* @param line
161+
* line
162+
* @return distance in meters
163+
* @since 2.2.2
164+
*/
165+
public static double distanceHaversine(Line line) {
166+
return distanceHaversine(line.startPoint(), line.endPoint());
167+
}
168+
156169
/**
157170
* Get the bearing heading in degrees between two points in degrees
158171
*

0 commit comments

Comments
 (0)