[geotk] [Newbie] Coordinate heading + transformation

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Tue Aug 18 06:03:13 EDT 2009


Sam B a écrit :
> Is there a simple way to calculate the heading 
> having two CARTESIAN coordinates ?

If the coordinates are cartesian in a projection that preserve angles (the 
Mercator projection used in the demo has this property), I suggest to just use 
the classical trigonometric function (converting from radians to degrees and 
having 0° pointing the north):

     import static java.lang.Math.*;

     heading = 90 - toDegrees(atan2(y,x));

	Martin


More information about the Geotoolkit mailing list