Class Haversine

java.lang.Object
org.apache.sedona.common.sphere.Haversine

public class Haversine extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
    Calculate the distance between two points on the earth using the "haversine" formula.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    distance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2)
     
    static double
    distance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2, double avg_earth_radius)
     
    static org.locationtech.jts.geom.Envelope
    expandEnvelope(org.locationtech.jts.geom.Envelope envelope, double distance, double sphereRadius)
    Expand the given envelope on sphere by the given distance in meter.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • AVG_EARTH_RADIUS

      public static final double AVG_EARTH_RADIUS
      Calculate the distance between two points on the earth using the "haversine" formula. This is also known as the great-circle distance This will produce almost identical result to PostGIS ST_DistanceSphere and ST_Distance(useSpheroid=false)
      See Also:
  • Constructor Details

    • Haversine

      public Haversine()
  • Method Details

    • distance

      public static double distance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2, double avg_earth_radius)
    • distance

      public static double distance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2)
    • expandEnvelope

      public static org.locationtech.jts.geom.Envelope expandEnvelope(org.locationtech.jts.geom.Envelope envelope, double distance, double sphereRadius)
      Expand the given envelope on sphere by the given distance in meter.
      Parameters:
      envelope - the envelope to expand
      distance - in meter
      sphereRadius - radius of the sphere in meter
      Returns:
      expanded envelope