Boost logo

Boost Users :

Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth
From: Barend Gehrels (barend_at_[hidden])
Date: 2012-03-04 12:01:52


Hi Sean,

On 4-3-2012 17:14, Sean Farrow wrote:
>
> Hi all:
>
> I need to calculate distances on the earth. Ideally I'd like to use
> the haversine formula.
>
> There is an example in the docs at:
>
> http://www.boost.org/doc/libs/1_49_0/libs/geometry/doc/html/geometry/quickstart.html
>
> under the non-Cartesian heading.
>
> Will this do what I need, or do I need the Geographical coordinate
> system, (if yes where is this available and what features does this
> supply?)
>

This will do what you ask for. So it will calculate distances on the
Earth using the Haversine formula.

However, it considers the Earth as a perfect sphere, which it is not. So
distances are rough approximations.

If you need more precise results indeed you will need the Geographic
coordinate system, and the distances then use Andoyer which is much more
precise.

That is not included in the current Release. So if you need it you have
to download the Trunk of Boost, and it is there available as an extension.

See the examples here:
https://svn.boost.org/svn/boost/trunk/libs/geometry/example_extensions/gis/latlong/

Regards, Barend



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net