Curtis L. Olson writes: > > You might be thinking too hard about this. > > The following seems to work really slick for me (assuming you are > doing smaller area maps or don't care about some distortion as you get > towards the top/bottom of the map. Even if this isn't quite good > enough for your needs, it will get you out of the gate running and you > can come back later and do something fancier. > > Pick some ($center_lon, $center_lat) to be the center of your map. > > Then calculate $xfacter = cos( $center_lat * $deg_to_rad ) > > Now set $h = height in pixels of your display and $w = width in pixels > of your display. > > You also want a $scale variable that is set to the something like > number of pixels per nautical mile. > > Also note that to convert from a degree of latitude to nm, multiply by > 60 (i.e. there are 60 nm for every degree of latitude.) > > Ok, so you have all that? > > Now if you want to draw something on your map (i.e. a VOR) at some > ($lon, $lat) just use the following formula: > > $x = $w/2 + ($lon - $center_lon) * $deg_to_nm * $scale * $xfact; > $y = $h/2 - ($lat - $center_lat) * $deg_to_nm * $scale; > > ($x, $y) is the coordinates (in screen space) where you should draw > the object. > > This is known to work pretty well over a local area (assuming my > typing is correct, I didn't overlook something, and you can get past > the pseudo-perl syntax.) :-)
This works fine for a 'map' but straight lines will not be great circles which AFAIK is still the standard for *most* aviation 'charts', both paper and electronic versions Cheers Norman _______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel