[postgis-users] Great circle as a linestring

Norman Vine nhv at cape.com
Fri Feb 29 08:57:57 PST 2008


One usually computes the midpoint along the great circle
then compares the distance it is from the straight line
between the endpoints and recursively does this for the 
resulting segments until the error term is 'good enough.

The algorithm goes something like

DrawGreatCircle(error,pt1,pt2,style):

 proj_pt1 = WorldToDevice(ProjFwd(pt1))
 proj_pt2 = WorldToDevice(ProjFwd(pt2))
 mid_pt   = MidPointGreatCircle(pt1,pt2)
 proj_mid = WorldToDevice(ProjFwd(mid_pt))

 if distPointLine2D (proj_mid, Line2D(proj_pt1,proj_pt2)) < error:
    DrawLine(proj_pt1,proj_pt2,style)
 else:
    DrawGreatCircle(error,pt1,mid_pt)
    DrawGreatCircle(error,mid_pt,pt2)

http://williams.best.vwh.net/avform.htm#Intermediate
 
HTH
 
Norman




More information about the postgis-users mailing list