On Jun 3, 2:12 pm, Marty <[email protected]> wrote:
> Hi,
>
> I would like to draw a static map and use a polyline to conect 2
> points.
>
> This is straight foward and rather easy to acomplish, my challenge is
> having the polyline follow the Great Circle path on the map instead of
> a straight line.
>
> Any ideas?
>
> Thanx in advance


formula by Ed Williams
Aviation Formulary V1.43
http://williams.best.vwh.net/avform.htm#Dist


=====================================
Intermediate points on a great circle

In previous sections we have found intermediate points on a great
circle given either the crossing latitude or longitude. Here we find
points (lat,lon) a given fraction of the distance (d) between them.
Suppose the starting point is (lat1,lon1) and the final point
(lat2,lon2) and we want the point a fraction f along the great circle
route. f=0 is point 1. f=1 is point 2. The two points cannot be
antipodal ( i.e. lat1+lat2=0 and abs(lon1-lon2)=pi) because then the
route is undefined. The intermediate latitude and longitude is then
given by:

        A=sin((1-f)*d)/sin(d)
        B=sin(f*d)/sin(d)
        x = A*cos(lat1)*cos(lon1) +  B*cos(lat2)*cos(lon2)
        y = A*cos(lat1)*sin(lon1) +  B*cos(lat2)*sin(lon2)
        z = A*sin(lat1)           +  B*sin(lat2)
        lat=atan2(z,sqrt(x^2+y^2))
        lon=atan2(y,x)

=======================
Distance between points

The great circle distance d between two points with coordinates
{lat1,lon1} and {lat2,lon2} is given by:

d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))

A mathematically equivalent formula, which is less subject to rounding
error for short distances is:

d=2*asin(sqrt((sin((lat1-lat2)/2))^2 +
                 cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))


======================

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to