Gerald I. Evenden geraldi.evenden at gmail.com
Wed Nov 12 11:44:38 EST 2008

```I've tried to stay out of this thread, but ... .

Unfortunately it keeps coming up.

BTW: when referring to distance calculations it is "geodesic" not geodetic.

On Wednesday 12 November 2008 10:50:37 am Frank Warmerdam wrote:
> Benoît Andrieu wrote:
> >
> > So, this leads to some questions (that are somehow related...) :
> > - how are computed distance calculation between two points by softwares
> > like Postgis for example ?
>
> Benoît,
>
> I'm not sure.
>
> > - is the best way to compute distance calculation to use UTM systems ? I
> > have to compute distances that could be very long (hundreds of
> > kilometers), strong accuracy is not required but I don't want to have
> > more than 1% accuracy error.
>
> Other have addressed this, but generally this is not a very good approach
> except for fairly local areas.

Very true and even if short distances are computed this way then one needs to
refer to the local scale factor and appropriately correct the pythagorean
computation.  If you are using lproj to determine the UTM (or tmerc)
coordinates, turn the -V switch on to get the scale factor.  Taking the mean
value for the two points should be adequate.

If you want to be lazy *and* do it the right way then for a very good
procedure to calculate inter point distances see:

http://www.ngs.noaa.gov/PC_PROD/Inv_Fwd/

and algorithm details published in:

www.ngs.noaa.gov/PUBS_LIB/inverse.pdf

Note: the first reference will point you to an online procedure to compute
geodesics.

We need to put the above in a standard location so that we can paste it into a
response any query to this group related to the geodesic.

> > - in what way are those functions distinct from the proj4 ? Am I wrong
> > to use them ? Are there others functions in proj4 that would allow me to
> > do the same things that I can do with those functions (distance
> > calculation between two points and point positionning given initial
> > point, distance and azimuth) ?
>
> The functions are not a core part of PROJ.4 as I understand it.  They
> aren't normally in the library - just linked with the geod command line
> program.

At one time a program called 'geod' was distributed with my versions of proj4
but it was based upon a poorer algorithm has has been dropped.  I believe it
my still be floating around in some distributions (and is probably good
enough for most applications).

I made a C version of the Vincente procedures but have not distributed it.

> I'm not opposed to treating them as a core capability but I do think some
> consideration should be given to the API before this would occur.  Ideally
> this would be something someone else than me might take on (possibly with