---
name: "GIS::Distance::Haversine"
section: "3pm"
platform: "linux"
package: "libgis-distance-perl"
version: "0.20-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/GIS::Distance::Haversine"
---

# GIS::Distance::Haversine(3pm)

Exact spherical distance calculations.

## NAME

GIS::Distance::Haversine - Exact spherical distance calculations.

## DESCRIPTION

This is the default distance calculation for GIS::Distance as it keeps a good balance between speed and accuracy.

A faster (XS) version of this formula is available as GIS::Distance::Fast::Haversine.

Normally this module is not used directly.  Instead GIS::Distance is used which in turn interfaces with the various formula classes.

## FORMULA

```
    dlon = lon2 - lon1
    dlat = lat2 - lat1
    a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
    c = 2 * atan2( sqrt(a), sqrt(1-a) )
    d = R * c
```

## SEE ALSO

- •

  \<http://mathforum.org/library/drmath/view/51879.html\>

- •

  \<http://www.faqs.org/faqs/geography/infosystems-faq/\>

## SUPPORT

See "SUPPORT" in GIS::Distance.

## AUTHORS

See "AUTHORS" in GIS::Distance.

## LICENSE

See "LICENSE" in GIS::Distance.
