module Haversine

Overview

The haversine formula determines the great-circle distance between two points on a sphere given their latitudes and longitudes.

https://en.wikipedia.org/wiki/Haversine_formula

Extended Modules

Defined in:

haversine.cr
haversine/distance.cr
haversine/version.cr

Constant Summary

EARTH_RADIUS = 6371008.8
FACTORS = {centimeters: EARTH_RADIUS * 100, centimetres: EARTH_RADIUS * 100, degrees: 360 / (2 * Math::PI), feet: EARTH_RADIUS * 3.28084, inches: EARTH_RADIUS * 39.37, kilometers: EARTH_RADIUS / 1000, kilometres: EARTH_RADIUS / 1000, meters: EARTH_RADIUS, metres: EARTH_RADIUS, miles: EARTH_RADIUS / 1609.344, millimeters: EARTH_RADIUS * 1000, millimetres: EARTH_RADIUS * 1000, nautical_miles: EARTH_RADIUS / 1852, radians: 1, yards: EARTH_RADIUS * 1.0936}

Unit of measurement factors using a spherical (non-ellipsoid) earth radius.

Keys are the name of the unit, values are the number of that unit in a single radians

VERSION = {{ (`shards version /__w/haversine/haversine/src/haversine`).chomp.stringify }}

Instance Method Summary

Instance Method Detail

def destination(latitude : Number, longitude : Number, distance : Number, bearing : Number, unit : Symbol = :kilometers) : Tuple(Float64, Float64) #

Takes the staring point by latitude, longitude and calculates the location of a destination point given a #distance factor in Haversine::FACTORS; and bearing in degrees(ranging from -180 to 180).

https://github.com/Turfjs/turf/blob/master/packages/turf-destination/index.ts


def destination(coord : Array(Number), distance : Number, bearing : Number, unit : Symbol = :kilometers) : Tuple(Float64, Float64) #

Takes the staring point by latitude, longitude and calculates the location of a destination point given a #distance factor in Haversine::FACTORS; and bearing in degrees(ranging from -180 to 180).

https://github.com/Turfjs/turf/blob/master/packages/turf-destination/index.ts


def destination(coord : Tuple(Number, Number), distance : Number, bearing : Number, unit : Symbol = :kilometers) : Tuple(Float64, Float64) #

Takes the staring point by latitude, longitude and calculates the location of a destination point given a #distance factor in Haversine::FACTORS; and bearing in degrees(ranging from -180 to 180).

https://github.com/Turfjs/turf/blob/master/packages/turf-destination/index.ts


def distance(lat1 : Number, lon1 : Number, lat2 : Number, lon2 : Number) : Haversine::Distance #

Calculates the haversine distance between two locations using latitude and longitude.


def distance(coord1 : Array(Number), coord2 : Array(Number)) : Haversine::Distance #

Calculates the haversine distance between two locations using latitude and longitude.


def distance(coord1 : Tuple(Number, Number), coord2 : Tuple(Number, Number)) : Haversine::Distance #

Calculates the haversine distance between two locations using latitude and longitude.