There are actually some lengthy discussions / debates that can be started
but here goes:

You need to define a little more detail about your objectives, specifically
your purpose and accuracy requirements.


This is not my recommendation; given the computing power that is generally
available you don't save anything, but....
IF (ALL CONDITIONS APPLY)
   1) The points are "close" together within 2 Km, and 
   2) Precision is not critical, an error of a few meters is acceptable, and
   3) You are not further North than say about 50 degrees Latitude 
        (this might be pushing it)
You could actually use simple planer polar geometry functions (Pathagorean).
   Approx error = (distance_between_points / Radii_of_Earth)^2.

As the points separate (become further apart) and/or you move to more
Northern latitudes. Forget doing this.

To determine the position of a point on a spherical model Use "Great Circle"
calculations.  The formula are designed to compute locations using a SPHERE,
Technically not The WGS84 Ellipsoid but the error is low enough that it is
generally considered acceptable with the following exceptions:

1) If you are measuring distances that subtend an angle > 180 degrees (half
the circumference of the globe) the cumulative error may not be acceptable.
This is something you would need to investigate.  For example, determining
distances between cities > 180 degrees apart would generally be acceptable
for something like "trip planning", but I wouldn't necessarily determine my
aircrafts fuel requirement without using a generous safety factor.

2) If you require high positional accuracy (sub meter or survey precision)
then you should transform to a different coordinate system (datum) that
models the earth surface as a plane and use appropriate formula.  Get out
your surveyors text and go from there.



Great Circle Calculations:

All Angles, Coordinates, and Length need to be converted to RADIAN measures:
Conversions:
   angle_radians = (pi/180) * angle_degrees
   angle_degrees = (180/pi) * angle_radians

   distance_radians = (pi/(180*60)) * distance_nautical_miles
   distance_nautical_miles = ((180*60)/pi) * distance_radians

Why Nautical Mile - It is convenient in its definition:  
   1 Nautical Mile = 1 minute of arc (1/60 of a degree)
   Current value = 1852 meters or 1.852 km
This is convenient when using WGS84 Ellipsoid (and other similar ones) as it
lies between the equatorial and polar measures.  That is:
  if 1 nautical mile = 1.852 km, 
  then the radii of the SPHERE, R = 1.852*(180*60/pi) = 6366.707 km  
    
WGS84
   Equatorial Radii = 6378.137 km
   Polar Radii = 6356.752 km


The formula you want:

Dest_lat = asin(sin(latitude1)* cos(dist)+ cos(latitude1)* sin(dist)*
           cos(heading))

d_lon = atan2(sin(heading)*sin(dist)*cos(latitude1),cos(dist)-
           sin(latitude1)*sin(latitude))

Dest_lon = mod( longitude1 - d_lon + pi, 2*pi )- pi

OR
Test your MOD() function (it should work correctly, but  there are some
implementation differences):
   Mod(m,n)
   Mod(340,60) = 40
   Mod(-340,60) = 20
   If MOD function not available, or does not work as expected:
      mod = ((longitude1 - d_lon + pi) - (2*pi)) * 
            int(longitude1 - d_lon + pi /2*pi)
      IF ( mod < 0 ) mod = mod + (2*pi)
      Dest_lon = mod - pi

In Java I think you use the "%" op (I have not tested this)
     Dest_lon = ((longitude1 - d_lon + pi) % (2*pi)) - pi



WHERE:
Dest_lat = destination point latitude, radians
Dest_lno = destination point longitude, radians
Latitude1, Longitude1 = The coordinates of the starting point, radians
Dist = The distance (length) along the lateral from the start point, radians
Heading = the direction of travel from true north, radians





-----Original Message-----
From: Tim Smith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 29, 2004 08:56 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: MI-L New lat/long from distance/bearing

Hi,
Thanks for people who have helped so far with this,

I want to draw a line in MapX between two points. The function in MapX
to do this takes two WGS-84 lat/long points.
I don't have two lat/long points. I have one lat/long, an angle in
degrees and a length in meters.
I need to calculate the second lat/long (unless there is a MapX function
that can draw a line - given a position, angle and distance).

A C++ algorithm to do it would be fine. I can't believe MapX doesn't
support such a calculation.

Tim



-----Original Message-----
From: Terry McDonnell [mailto:[EMAIL PROTECTED] 
Sent: 29 June 2004 15:42
To: Tim Smith
Subject: RE: MI-L New lat/long from distance/bearing


Is your problem what algorithm to create to do this or how to do it Mapx
or code it in C++?  IOW do you not know how to go about it?

Terry

-----Original Message-----
From: Tim Smith [mailto:[EMAIL PROTECTED] 
Sent: 29 June 2004 12:42
To: [EMAIL PROTECTED]
Subject: MI-L New lat/long from distance/bearing


Hi List,

I have a latitude and longitude in WGS-84.
I want to calculate a new point based on a bearing and distance from
this position.

Difficult bit -
I want to calculate this using MapX, or alternatively I could use some
C/C++ code.

Thanks for any help with this

Kind regards

Tim Smith

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12390


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12395


---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 12415

Reply via email to