Skip to content

Haversine distance may be using the wrong phi1 and phi2 angle #11308

Description

@lucasalavapena

Repository commit

2e405f3

Python version (python --version)

NA

Dependencies version (pip freeze)

NA

Expected behavior

First of thanks for all the algorithms and the work!

The current (and initial) implementation of the haversine distance is using reduced latitudes (as one does for Lambert's formula see https://en.wikipedia.org/wiki/Geographical_distance#Lambert's_formula_for_long_lines), however, from my understanding the haversine distance should be using the raw latitudes (in radians like the longitudes are currently being handled). At least that is how it is written in https://en.wikipedia.org/wiki/Haversine_formula#Formulation .

The haversine distance from my understanding is supposed to work on a sphere, however, the notion on reduced latitude and flattening factors exist to deal with the non-spherical nature of the Earth (see https://en.wikipedia.org/wiki/Flattening). I am by no means an expert, I could very well be wrong.

Moreover, reading the wikipage and other implementations the transformation to a reduced latitude is not needed for the haversine distance, the latitude is used directly. Here are some references:

additional implementations:

I think most likely there was some confusion with Lambert's formula.

I am happy to make a small PR, if there is an agreement with my observation.

Actual behavior

Use the right angles and the results should slightly be different. I did some test, it is not that significant.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions