Great Circle

Topics: SharpMap v0.9 / v1.x, SharpMap v2.0, WinForms Controls
Apr 4, 2011 at 9:50 AM

Hi,

I'm programming a GIS application in C# and I would like to draw an orthodromic curve (great circle) between two points on the map.

Does anybody know how to do that?

Thanks for your help.

S.

Coordinator
Apr 4, 2011 at 9:57 AM
Edited Apr 4, 2011 at 9:58 AM

shouba, IMHO all you have to do is place intermediate points on your line, e.g. instead of

LINESTRING(-180 45 180 45)

you should use

LINESTRING(-180 45, -170 45, ... , 0 45, ..., 170 45, 180 45)

Now, depending on your CoordinateTransformation, your line should be rendered -more- correctly.

Hth FObermaier

Apr 4, 2011 at 10:15 AM

Hi FObermaier.

Thanks for your quick answer. But how can I calculate these intermediate points?

S.

Apr 4, 2011 at 10:21 AM

Hi,

I just find something that might help on http://williams.best.vwh.net/avform.htm#Par.

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)
I'll try and tell if it works.
S.
Apr 5, 2011 at 8:37 AM

Hi,

Ok, it works. You have just to convert lat1,lat2,lon1,long2 in radian before the calculation and in the end to convert lat,lon to degree.

S.