Class SphericalHaversineEarthModel

  • All Implemented Interfaces:
    EarthModel

    public class SphericalHaversineEarthModel
    extends AbstractEarthModel
    A simple spherical earth model using radius 6371009 m.

    For distance computations, this variant uses the Haversine formula, which is faster but less accurate than Vincenty's formula.

    Since:
    0.6.0
    Author:
    Erich Schubert
    • Constructor Detail

      • SphericalHaversineEarthModel

        protected SphericalHaversineEarthModel()
        Constructor.
    • Method Detail

      • latLngRadToECEF

        public double[] latLngRadToECEF​(double lat,
                                        double lng)
        Description copied from interface: EarthModel
        Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.

        The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.

        Specified by:
        latLngRadToECEF in interface EarthModel
        Overrides:
        latLngRadToECEF in class AbstractEarthModel
        Parameters:
        lat - Latitude in radians
        lng - Longitude in radians
        Returns:
        Coordinate triple, in meters.
      • latLngRadToECEF

        public double[] latLngRadToECEF​(double lat,
                                        double lng,
                                        double h)
        Description copied from interface: EarthModel
        Map a radians latitude, longitude pair to 3D X-Y-Z coordinates, using a spherical earth model.

        The coordinate system is usually chosen such that the earth rotates around the Z axis and X points to the prime meridian and Equator.

        Specified by:
        latLngRadToECEF in interface EarthModel
        Overrides:
        latLngRadToECEF in class AbstractEarthModel
        Parameters:
        lat - Latitude in radians
        lng - Longitude in radians
        h - Height
        Returns:
        Coordinate triple, in meters.
      • ecefToLatRad

        public double ecefToLatRad​(double x,
                                   double y,
                                   double z)
        Description copied from interface: EarthModel
        Convert a 3D coordinate pair to the corresponding latitude.
        Specified by:
        ecefToLatRad in interface EarthModel
        Overrides:
        ecefToLatRad in class AbstractEarthModel
        Parameters:
        x - X value
        y - Y value
        z - Z value
        Returns:
        Latitude in radians
      • distanceRad

        public double distanceRad​(double lat1,
                                  double lng1,
                                  double lat2,
                                  double lng2)
        Description copied from interface: EarthModel
        Compute the geodetic distance between two surface coordinates.
        Specified by:
        distanceRad in interface EarthModel
        Overrides:
        distanceRad in class AbstractEarthModel
        Parameters:
        lat1 - Latitude of first in radians.
        lng1 - Longitude of first in radians.
        lat2 - Latitude of second in radians.
        lng2 - Longitude of second in radians.
        Returns:
        Distance in meters.