org.apache.sis.distance

## Class DistanceUtils

- Object
- - DistanceUtils

-     public final class DistanceUtils
      extends Object

  Class to calculate distances on earth surface. Actual calculation code very similar to Apache SIS but refractor to allow use of custom classes.
  Warning: This class may change in a future SIS version. Current implementation performs computations on a sphere of hard-coded radius. A future implementation should perform computations on a given ellipsoid.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `EARTH_RADIUS`
    `static double` | `HALF_EARTH_CIRCUMFERENCE`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `getHaversineDistance(double latitude1, double longitude1, double latitude2, double longitude2)` Calculates haversine (great circle) distance between two lat/lon coordinates.
    `static DirectPosition2D` | `getPointOnGreatCircle(double latitude, double longitude, double d, double bearing)` Returns a coordinate on the great circle at the specified bearing.

    - ### Methods inherited from class Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### EARTH_RADIUS

          public static final int EARTH_RADIUS

      See Also:
        Constant Field Values

    - #### HALF_EARTH_CIRCUMFERENCE

          public static final double HALF_EARTH_CIRCUMFERENCE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getPointOnGreatCircle

          public static DirectPosition2D getPointOnGreatCircle(double latitude,
                                                               double longitude,
                                                               double d,
                                                               double bearing)

      Returns a coordinate on the great circle at the specified bearing.
      Parameters:
        `latitude` - the latitude of center of circle
        `longitude` - the longitude of center of circle
        `d` - the distance from the center
        `bearing` - the great circle bearing
      Returns:
        a coordinate at the specified bearing

    - #### getHaversineDistance

          public static double getHaversineDistance(double latitude1,
                                                    double longitude1,
                                                    double latitude2,
                                                    double longitude2)

      Calculates haversine (great circle) distance between two lat/lon coordinates.
      Parameters:
        `latitude1` - latitude of first coordinate
        `longitude1` - longitude of first coordinate
        `latitude2` - latitude of second coordinate
        `longitude2` - longitude of second coordinate
      Returns:
        great circle distance between specified lat/lon coordinates

Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.