Package 

Object LocationCompute.Companion

    • Constructor Detail

    • Method Detail

      • distanceBetween

         final Unit distanceBetween(Double startLatitude, Double startLongitude, Double endLatitude, Double endLongitude, FloatArray results)

        Computes the approximate distance in meters between two locations, and optionally the initial and final bearings of the shortest path between them. Distance and bearing are defined using the WGS84 ellipsoid.

        The computed distance is stored in results0. If results has length 2 or greater, the initial bearing is stored in results1. If results has length 3 or greater, the final bearing is stored in results2.

        Parameters:
        startLatitude - the starting latitude
        startLongitude - the starting longitude
        endLatitude - the ending latitude
        endLongitude - the ending longitude
        results - an array of floats to hold the results
      • computeDistanceFast

        @Synchronized() final Double computeDistanceFast(Double lat1, Double lon1, Double lat2, Double lon2)

        Compute distance on Earth approximated as sphere.

        Parameters:
        lat1 - latitude of first point
        lon1 - longitude of first point
        lat2 - latitude of second point
        lon2 - longitude of second point
      • computeDistanceAndBearingFast

         final Unit computeDistanceAndBearingFast(Double latP1, Double lonP1, Double latP2, Double lonP2, DoubleArray results)

        Compute distance and bearing on Earth approximated as sphere. <br></br><br></br>Compute is based on Haversine formula http://en.wikipedia.org/wiki/Haversine_formula <br></br><br></br>Precision is around 99.9%, speed around 5x faster then above method.

        Parameters:
        latP1 - latitude of first point
        lonP1 - longitude of first point
        latP2 - latitude of second point
        lonP2 - longitude of second point
        results - one (only distance) or two sized array for a results