Package org.apache.sedona.common.sphere
Class Haversine
java.lang.Object
org.apache.sedona.common.sphere.Haversine
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleCalculate the distance between two points on the earth using the "haversine" formula. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubledistance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2) static doubledistance(org.locationtech.jts.geom.Geometry geom1, org.locationtech.jts.geom.Geometry geom2, double avg_earth_radius) static org.locationtech.jts.geom.EnvelopeexpandEnvelope(org.locationtech.jts.geom.Envelope envelope, double distance, double sphereRadius) Expand the given envelope on sphere by the given distance in meter.
-
Field Details
-
AVG_EARTH_RADIUS
public static final double AVG_EARTH_RADIUSCalculate 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 expanddistance- in metersphereRadius- radius of the sphere in meter- Returns:
- expanded envelope
-