---------- Forwarded message ----------
From: Barend Gehrels <barend@xs4all.nl>
To: boost-users@lists.boost.org
Cc: 
Date: Sun, 04 Mar 2012 18:01:52 +0100
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth
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




---------- Forwarded message ----------
From: Sean Farrow <sean.farrow@seanfarrow.co.uk>
To: "boost-users@lists.boost.org" <boost-users@lists.boost.org>
Cc: 
Date: Sun, 4 Mar 2012 17:13:21 +0000
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth

Hi:

Ok, thanks, What (roughly) is the difference in precision? I’m using this to determine the distance between two buildings.

Cheers

Sean.

 

From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Barend Gehrels
Sent: 04 March 2012 17:02
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth

 

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



---------- Forwarded message ----------
From: Barend Gehrels <barend@xs4all.nl>
To: boost-users@lists.boost.org
Cc: 
Date: Sun, 04 Mar 2012 18:36:11 +0100
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth
Hi Sean,

On 4-3-2012 18:13, Sean Farrow wrote:

Hi:

Ok, thanks, What (roughly) is the difference in precision? I’m using this to determine the distance between two buildings.


The sampes give an idea, but that is between cities (miles away). Between buildings the difference will be  less, but I've not tested it. So the best is to test that yourself (and the results are interesting for the list ;-) )

Regards, Barend



---------- Forwarded message ----------
From: Sean Farrow <sean.farrow@seanfarrow.co.uk>
To: "boost-users@lists.boost.org" <boost-users@lists.boost.org>
Cc: 
Date: Sun, 4 Mar 2012 17:49:04 +0000
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth

Hi:

I’ll test this and get back to the list. Do we have any idea as to whether/when the extension(s) will become part of the official distribution?

Cheers

Sean.

From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Barend Gehrels
Sent: 04 March 2012 17:36
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] [Geometry] Calculating distances on the earth

 

Hi Sean,

On 4-3-2012 18:13, Sean Farrow wrote:

Hi:

Ok, thanks, What (roughly) is the difference in precision? I’m using this to determine the distance between two buildings.


The sampes give an idea, but that is between cities (miles away). Between buildings the difference will be  less, but I've not tested it. So the best is to test that yourself (and the results are interesting for the list ;-) )

Regards, Barend




If you are using latitude/longitude then these methods will work: 
1)  Consider implementing Vincentys method, proposed by Thaddeus Vincenty,  and is documented at
http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf,  I believe this has a precision of around 0.5mm. Be careful to avoid domain errors near the poles. This has the advantage of also calculating forward and back azimuth.

2) Andoyer's method which also takes flattening into account but loses precision for very short distances.

Alternatively since you are working with short distances implement Redfearn's formulae to generate UTM coordinates and then use planar geometry.

For more information see: http://www.ga.gov.au/geodesy/datums/calcs.jsp#trans
There is a pdf manual (containing all the formulae) (http://www.icsm.gov.au/gda/gdatm/index.html)  and excel worksheets along with on-line calculators that you can use here.

Regards
   Andrew

--
___________________________________________
Andrew J. P. Maclean

___________________________________________