From: Alexis on
Hi,

I am trying to create an on the fly image of runway layouts but am
hitting a brick wall.

I have both the starting and ending coordinates of each runway, it's
length, as well as it's angle of direction (heading).

I can draw one runway without any problem, but where I am falling short
is how to 'scale', if that is the right word, the other runway(s) to
display properly in a 500x500px image


function imagepolarline($image,$x1,$y1,$length,$angle,$color)
{
$length=($length/500)*20;
$x2 = $x1 + cos( deg2rad($angle-90)) * $length;
$y2 = $y1 + sin( deg2rad($angle-90)) * $length;
imageline($image, $x1,$y1,$x2,$y2, $color);
}

//'base' coords
$x1=200;$y1=200;

$scale=10000;

//if first runway
if ($d==0) {$xbase=abs($lon1);$ybase=abs($lat1);}
//for all others
else
{
$x1=$x1+(($xbase-(abs($lon1)))*$scale);
$y1=$y1+(($ybase-(abs($lat1)))*$scale);
}


Here is some test data if that would help:
"length","lat_start","lon_start","heading","lat_stop","lon_stop"
"6869","38.8424","-77.0368","355.5000","38.8612","-77.0387"
"4911","38.8423","-77.0408","26.0000","38.8544","-77.0333"
"5204","38.8617","-77.0438","142.7000","38.8503","-77.0327"

Any suggestions would be most appreciated.

Alexis