# No subject

Net.Noise owner news at max.cecer.army.mil
Thu Jul 8 00:05:02 EDT 1993

```Newsgroups: info.grass.programmer
Path: zorro.cecer.army.mil!shapiro
From: shapiro at zorro.cecer.army.mil (Michael Shapiro)
Subject: Re: basic projection question
Message-ID: <C9tvCB.4Mp at news.cecer.army.mil>
Sender: news at news.cecer.army.mil (Net.Noise owner)
Organization: US Army Corps of Engineers Construction Engineering Research Labs
References: <9307070737.AA12583 at bushland.ecn.purdue.edu>
Date: Thu, 8 Jul 1993 04:04:59 GMT
Lines: 44

In <9307070737.AA12583 at bushland.ecn.purdue.edu> mccauley at ecn.purdue.edu (Darrell McCauley) writes:

>Trying to make my programs more lat-long friendly...
>  G_begin_distance_calculations();
>I need to calculate the angle of a line made between two
>points (x1,y1) and (x2,y2).
>
>The distance between the points (the hypotenuse in
>geometric/planimetric terms) is
>
>  d = G_distance (x1, y1, x2, y2);
>
>In a planimetric projection, the angle (in degrees) would be:
>
>  angle = 180.0 / 3.14159 * acos ( (x1-x2) /d )
>
>but with lat-long I don't believe that this is the case
>(because the distance between two longitudes is different,
>depending upon what latitude you are at).  Would the
>correct way to compute this angle be:
>
>  angle = 180.0 / 3.14159
>        * acos ((G_distance(x1,y1,x2,y1)+G_distance(x1,y2,x2,y2)) /2.0
>        / d);

>(that is, averaging the two distances at lat1 and lat2 to come
>up with the numerator for the inverse cosine quotient).
>This approach seems sort of naive but I cannot think of
>anything better at the moment.

What I think you want is an azimuth calculation and I'm sure this
isn't the right way to do it. There is no formula in GRASS presently
neither for spheres or ellipsoids. Does someone have a reference for
this calculation so it can be coded and added to the GRASS library?
>Is this correct approach? Is there a library function that I am
>missing which would do what I want?

>--Darrell
--
Michael Shapiro               shapiro at zorro.cecer.army.mil
U.S. Army CERL                (217) 373-7277
P.O. Box 9005
Champaign, Ill. 61826-9005

```

More information about the grass-dev mailing list