age(),0);
$age -= (($age>14)?(($age>21)?2:1):0);
if ($age>28) { $age=28; }
$moonImage = 'ajax-images/moon/w/NH-moon'.(($age<10&&!strpos($age,'0'))?'0'.$age:$age).'.gif';
saveImage($moonImage,"jpmoon.png",50,50);
maketransparent("http://umbra.nascom.nasa.gov/images/latest_solisHe_thumbnail.gif","jpsun.png",50,50);
}
function saveImage($oldfile,$newfile,$width,$height)
// Save Image and re-size
{
$info = getimagesize($oldfile);
$im = imagecreatefromgif($oldfile);
$img = imagecreatetruecolor($width,$height);
imagecopyresized($img,$im,0,0,0,0,$width,$height,$info[0],$info[1]);
imageinterlace($im);
imagepng($im,$newfile);
imagedestroy($img);
}
function maketransparent($oldfile,$newfile,$width,$height)
// Turn black background transparent and re-size
{
$info = getimagesize($oldfile);
$im = imagecreatefromgif($oldfile);
$img = imagecreatetruecolor($width,$height);
$trans = imagecolorallocate($img, 0x00, 0x00, 0x00);
imagecolortransparent($img,$trans);
imagecopyresized($img,$im,0,0,0,0,$width,$height,$info[0],$info[1]);
imagetruecolortopalette($img, true, 256);
imageinterlace($img);
imagepng($img,$newfile);
imagedestroy($img);
}
function set_tz ($TZ){
if (phpversion() >= "5.1.0") {
date_default_timezone_set($TZ);
} else {
putenv("TZ=" . $TZ);
}
}
function sun_pos($UnixTimestamp, $latitude, $longitude) {
$year = date("Y",$UnixTimestamp);
$month = date("n",$UnixTimestamp);
$day = date("j",$UnixTimestamp);
$UT = gmdate("H",$UnixTimestamp)+gmdate("i",$UnixTimestamp)/60+gmdate("s",$UnixTimestamp)/3600;
$d = round(367 * $year - (7 * ($year + (($month + 9)/12)))/4 + (275 * $month)/9 + $day - 730530);
$w = 282.9404 + 0.0000470935 * $d;
$e = 0.016709 - 0.000000001151 * $d;
$M = 356.0470 + 0.9856002585 * $d;
$M = fmod($M , 360);
if ($M < 0){$M = $M+360;}
$L = $w + $M;
$L = fmod($L , 360);
$oblecl = 23.4393 - 0.0000003563 * $d ;
$E = rad2deg(deg2rad($M) + (180/M_PI) * deg2rad($e) * sin(deg2rad($M)) * (1 + $e * cos(deg2rad($M))));
$x = cos(deg2rad($E)) - $e;
$y = sin(deg2rad($E)) * sqrt(1 - $e*$e);
$r = sqrt($x*$x + $y*$y);
$v = rad2deg(atan2( deg2rad($y), deg2rad($x)) );
$lon = $v + $w;
$lon = fmod($lon, 360);
$x_rect = $r * cos(deg2rad($lon));
$y_rect = $r * sin(deg2rad($lon));
$z_rect = 0.0;
$z = 0.0;
$x_equat = $x_rect;
$y_equat = $y_rect * cos(deg2rad($oblecl)) + $z * sin(deg2rad($oblecl));
$z_equat = $y_rect * sin(deg2rad($oblecl)) + $z * cos(deg2rad($oblecl));
$r = sqrt( $x_equat*$x_equat + $y_equat*$y_equat + $z_equat*$z_equat );
$RA = rad2deg(atan2( deg2rad($y_equat), deg2rad($x_equat) ));
$Decl = rad2deg(atan2( deg2rad($z_equat), deg2rad(sqrt( $x_equat*$x_equat + $y_equat*$y_equat ))) );
$GMST0 = $L/15 + 12;
$SIDTIME = $GMST0 + $UT + $longitude/15;
$HA = $SIDTIME*15 - $RA;
$x = cos(deg2rad($HA)) * cos(deg2rad($Decl));
$y = sin(deg2rad($HA)) * cos(deg2rad($Decl));
$z = sin(deg2rad($Decl));
$xhor = $x * cos(deg2rad(90) - deg2rad($latitude)) - $z * sin(deg2rad(90) - deg2rad($latitude));
$yhor = $y;
$zhor = $x * sin(deg2rad(90) - deg2rad($latitude)) + $z * cos(deg2rad(90) - deg2rad($latitude));
$azimuth = round(rad2deg(atan2($yhor, $xhor)) + 180);
$altitude = round(rad2deg(asin($zhor )));
$pos = array($azimuth, $altitude);
return $pos;
}
//calculations start here
$dst = date("I");
$tdiff = ((date("Z"))/3600);
$year = date("Y");
$mo = date("n");
$day = date("j");
$ahour = (date("G") + (date("i")/60));
//constants for sun
$dsj2k = (367*$year)-floor(7*($year+floor(($mo+9)/12))/4)+(floor(275*$mo/9)+$day-730531.5+(-$tdiff)/24);
//$dsj2k = (367*$year)-floor(7*($year+floor(($mo+9)/12))/4)+(floor(275*$mo/9)+$day-730531.5+(-$tz-$dst)/24);
$csj2k = ($dsj2k/36525);
$lst = fmod((280.46061837 + (360.98564736629*($dsj2k+ $lon))),360);
$epsilon = (23.439 - (0.0000004 * $dsj2k));
$eff = (180/pi());
$tee = pow(tan(deg2rad($epsilon/2)),2);
for ($qq = 0; $qq <= 25; $qq += 1) {
if ($qq == 25) {
$hour = $ahour;
} else {
$hour = ($qq);
}
$gtime[] = $hour;
//sunstuff
$FNday = (367*$year)-floor(7*($year+floor(($mo+9)/12))/4)+(floor(275*$mo/9)+$day-730531.5+(-$tdiff)/24)+($hour/24);
$lsun = fmod((280.461 + (0.9856474 * $FNday)), 360);
$gee = fmod((357.528 + (0.9856003 * $FNday)), 360);
$lambda = (($lsun+1.915 * sin(deg2rad($gee))) + (0.02 * sin(deg2rad(2 *$gee))));
$rasun = $lambda - $eff*$tee*sin(deg2rad(2*$lambda)) + $eff/2 * pow($tee,2) * sin(deg2rad(4*$lambda));
$decsun = rad2deg(asin(sin(deg2rad($epsilon))*sin(deg2rad($lambda))));
$hasun = fmod((280.46061837 + (360.98564736629*$FNday) + ($lon-$rasun)), 360);
//$ssalt = sin(deg2rad($decsun))* sin(deg2rad($lat))+cos(deg2rad($decsun))*cos(deg2rad($lat))*cos(deg2rad($hasun));
$salt = (rad2deg(asin(sin(deg2rad($decsun))* sin(deg2rad($lat))+cos(deg2rad($decsun))*cos(deg2rad($lat))*cos(deg2rad($hasun)))));
$sunpos[] = $salt;
//Sun azimuth
$coslat = cos(deg2rad($lat));
$sinlat = sin(deg2rad($lat));
$decsunr = deg2rad($decsun);
$rasunr = deg2rad($rasun);
$ddat = ($decsun + (20.0383 * cos($rasunr))/36*($FNday/36525));
$cosddat = cos(deg2rad($decsun + (20.0383 * cos($rasunr))/36*($FNday/36525)));
$sinddat = sin(deg2rad($decsun + (20.0383 * cos($rasunr))/36*($FNday/36525)));
$sinHA = sin(deg2rad($hasun));
$sinalt = sin(deg2rad($salt));
$suny = (-1 * $coslat * $cosddat * $sinHA);
$sunx = ($sinddat - $sinlat * $sinalt);
$sunA1 = atan($suny/$sunx);
//$sunazr
if ($sunx < 0) {
$sunazr = (pi() + $sunA1);
} elseif ($suny < 0) {
$sunazr = ((2*pi()) + $sunA1);
} else {
$sunazr = ($sunA1);
}
$sunazd = rad2deg($sunazr);
$sunazi[] = $sunazd;
//moonstuff
$mtee = ($FNday/36525);
$mlambda = fmod(218.32 + 481267.883 * $mtee,360)
+ 6.29 * sin(deg2rad(fmod(134.9 + 477198.85 * $mtee,360)))
- 1.27 * sin(deg2rad(fmod(259.2 - 413335.38 * $mtee,360)))
+ 0.66 * sin(deg2rad(fmod(235.7 + 890534.23 * $mtee,360)))
+ 0.21 * sin(deg2rad(fmod(269.9 + 954397.7 * $mtee, 360)))
- 0.19 * sin(deg2rad(fmod(357.5 + 35999.05 * $mtee, 360)))
- 0.11 * sin(deg2rad(fmod(186.6 + 966404.05 * $mtee, 360)));
$mbeta = ((5.13 * sin(deg2rad(fmod(93.3 + (483202.03 * $mtee), 360))))
+ (0.28 * sin(deg2rad(fmod(228.2 + (960400.87 * $mtee), 360))))
- (0.28 * sin(deg2rad(fmod(318.3 + (6003.18 * $mtee), 360))))
- (0.17 * sin(deg2rad(fmod(217.6 - (407332.2 * $mtee), 360)))));
$mpi = 0.9508
+ (0.0518 * cos(deg2rad(fmod(134.9 + 477198.85 * $mtee, 360))))
+ (0.0095 * cos(deg2rad(fmod(259.2 - 413335.38 * $mtee, 360))))
+ (0.0078 * cos(deg2rad(fmod(235.7 + 890534.23 * $mtee, 360))))
+ (0.0028 * cos(deg2rad(fmod(269.9 + 954397.7 * $mtee, 360))));
$mr = 1/(sin(deg2rad($mpi)));
$ml = cos(deg2rad($mbeta))*cos(deg2rad($mlambda));
$mm = 0.9175 * cos(deg2rad($mbeta))*sin(deg2rad($mlambda)) - (0.3978 * sin(deg2rad($mbeta)));
$mn = 0.3978 * cos(deg2rad($mbeta))*sin(deg2rad($mlambda)) + (0.9175 * sin(deg2rad($mbeta)));
$mA = rad2deg(atan($mm/$ml));
//$ramoon
if ($ml < 0) {
$ramoon = ($mA + 180);
} elseif ($mm < 0) {
$ramoon = ($mA + 360);
} else {
$ramoon = ($mA);
}
$decmoon = rad2deg(asin($mn));
$mx = $mr*cos(deg2rad($decmoon))*cos(deg2rad($ramoon)) - cos(deg2rad($lat))*cos(deg2rad(fmod(280.46061837 + 360.98564736629*$FNday+ $lon, 360)));
$my = $mr*cos(deg2rad($decmoon))*sin(deg2rad($ramoon)) - cos(deg2rad($lat))*sin(deg2rad(fmod(280.46061837 + 360.98564736629*$FNday+ $lon, 360)));
$mz = $mr*sin(deg2rad($decmoon))-sin(deg2rad($lat));
$mr1 = sqrt(($mx*$mx)+($my*$my)+($mz*$mz));
$mA1 = rad2deg(atan($my/$mx));
//$ramoon1
if ($mx < 0) {
$ramoon1 = ($mA1 + 180);
} elseif ($my < 0) {
$ramoon1 = ($mA1 + 360);
} else {
$ramoon1 = ($mA1);
}
$decmoon1 = rad2deg(asin($mz/$mr1));
$hamoon1 = fmod(280.46061837 + 360.98564736629*$FNday+ $lon-$ramoon1,360);
//$smalt = sin(deg2rad($decmoon1))*sin(deg2rad($lat))+cos(deg2rad($decmoon1))*cos(deg2rad($lat))*cos(deg2rad($hamoon1));
$malt = rad2deg(asin(sin(deg2rad($decmoon1))*sin(deg2rad($lat))+cos(deg2rad($decmoon1))*cos(deg2rad($lat))*cos(deg2rad($hamoon1))));
$moonpos[] = $malt;
/*###########################################################################################################################
http://eclipse.gsfc.nasa.gov/LEvis/LEaltitude.html
In our current example the azimuth of the Moon is then:
Azimuth of Moon: A = ArcTan [-(Cos d Sin h)/(Sin d Cos f - Cos d Cos h Sin f)]
= ArcTan [-(Cos(19.8) Sin(-9))/(Sin(19.8) Cos(38.9) - Cos(19.8) Cos(-9) Sin(38.9))]
= ArcTan [-(0.941 * -0.156) / ((0.339 * 0.778) - (0.941 * 0.988 * 0.628))]
= ArcTan [-(-0.147) / ((0.264) - (0.584))]
= ArcTan [ +0.147 / (-0.320)]
= ArcTan [ -0.459 ]
= -24.7°
*/ ########################################################################################################################
//$azmoon = rad2deg(atan(-(cos(deg2rad($decmoon))*sin(deg2rad($hamoon1)))/(sin(deg2rad($decmoon))*cos(deg2rad($lat)) - cos(deg2rad($decmoon))*cos(deg2rad($hamoon1))*sin(deg2rad($lat)))));
$azm = (atan(-(cos(deg2rad($decmoon))*sin(deg2rad($hamoon1)))));
$denom = (sin(deg2rad($decmoon))*cos(deg2rad($lat)) - cos(deg2rad($decmoon))*cos(deg2rad($hamoon1))*sin(deg2rad($lat)));
//echo "
";
if($denom <= 0){$azmoon = rad2deg(atan(($azm / $denom))) + 180;}
else if ($denom >= 0 ){$azmoon = rad2deg(atan(($azm / ($denom))));}
if ($azmoon < 0){$azmoon = $azmoon + 360;}
//$azmoon = fmod($azmoon,360);
//$moonazi[] = $azmoon;
//$azmoon = rad2deg(atan(-(cos(deg2rad($decmoon))*sin(deg2rad($hamoon1)))/(sin(deg2rad($decmoon))*cos(deg2rad($lat)) - cos(deg2rad($decmoon))*cos(deg2rad($hamoon1))*sin(deg2rad($lat)))));
//$azmoon = $azmoon+180;
//if ($azmoon < 0){$azmoon = $azmoon+360;}//else if($azmoon>=0 && $azmoon <=90){$azmoon = $azmoon+180;}//else{$azmoon = ($azmoon);}
$moonazi[] = $azmoon;
//$azm = (atan(-(cos(deg2rad($decmoon))*sin(deg2rad($hamoon1)))));
//$denom = (sin(deg2rad($decmoon))*cos(deg2rad($lat)) - cos(deg2rad($decmoon))*cos(deg2rad($hamoon1))*sin(deg2rad($lat)));
}
/*
echo "
"; echo "gtime "; print_r ($gtime); echo "sunpos "; print_r ($sunpos); echo "sunazi "; print_r ($sunazi); echo "moonpos "; print_r ($moonpos); echo "moonazi "; print_r ($moonazi); ########################################################################################################################## Since the denominator in ArcTan [ +0.147 / (-0.320)] is negative, we must add 180° to the final answer: A = -24.7° + 180° A = 155.3° folowing this I have a correct azimuth HALF the time, don't know how to handle the other half */ for ($i=0;$i<25;$i++){ if ($moonazi[$i] <= 0){$moonazi[$i] = $moonazi[$i]+180;} else if ($moonazi[$i] >> 0){$moonazi[$i] = $moonazi[$i];} } ########################################################################################################################## for ($i=0;$i<=24;$i++){$tm11[$i]=$sunazi[$i];} $saz[0] = $sunazi[25]; for ($i=0;$i<=24;$i++){$tm21[$i]=$moonazi[$i];} $maz[0] = round($moonazi[25]); $he5[0] = round($moonpos[25]); for ($i=0;$i<=24;$i++){$he61[$i]=$moonpos[$i];} $he7[0] = round($sunpos[25]); for ($i=0;$i<=24;$i++){$he81[$i]=$sunpos[$i];} # ##END FUNCTIONS############################################################################### # /* CREATE SUN PATH */ if (version_compare(PHP_VERSION, '5.2.1', '>')) { $sun_info = date_sun_info(strtotime(date("Y/n/j",time())), $lat, $lon); } else { $sun_info = date_sun_info(strtotime(date("Y/n/j",time())), $lon, $lat); // A bug in the earlier versions. } $day=$sun_info["sunset"]-$sun_info["sunrise"]; ###################################################################### $hours = $day / 3600; // 3600 seconds in an hour # $minutes = ($hours - floor($hours)) * 60; # $final_minutes = round($minutes); if ($final_minutes <= 9){$final_minutes = "0" . $final_minutes;} $dl = $final_hours = floor($hours) . ":" . $final_minutes; ###################################################################### $sr = date("h:i a",$sun_info["sunrise"]); $zen = date("h:i a",$sun_info["transit"]); $ss = date("h:i a",$sun_info["sunset"]); $b = array(); $a = ($sun_info["transit"]-36000); for ($i=0;$i<=25;$i++){ $a=$a+3600; $b[] = $a; } foreach ($b as $v) { $pos = sun_pos($v,$lat,$lon); $az[] = $pos[0]; $he[] = $pos[1]; } //Hi position $sun_info = date_sun_info(strtotime("21 June".date("Y",time())), $lat,$lon); $b = array(); $a = ($sun_info["transit"]-36000); for ($i=0;$i<=49;$i++){ $a=$a+1800; $b[] = $a; } foreach ($b as $v) { $pos = sun_pos($v,$lat,$lon); $az0[] = $pos[0]; $he0[] = $pos[1]; } // Autumnal Eq $sun_info = date_sun_info(strtotime("21 September".date("Y",time())),$lat,$lon); $b = array(); $a = ($sun_info["transit"]-36000); for ($i=0;$i<=25;$i++){ $a=$a+3600; $b[] = $a; } foreach ($b as $v) { $pos = sun_pos($v,$lat,$lon); $az3[] = $pos[0]; $he3[] = $pos[1]; } //Low position $sun_info = date_sun_info(strtotime("21 December".date("Y",time())), $lat,$lon); $b = array(); $a = ($sun_info["transit"]-32400); for ($i=0;$i<=25;$i++){ $a=$a+3600; $b[] = $a; } foreach ($b as $v) { $pos = sun_pos($v,$lat,$lon); $az1[] = $pos[0]; $he1[] = $pos[1]; } function getTimestamp ($val) { list ($hour,$min) = preg_split("/:/",$val); $ttl = ($min * 60) + ($hour * 60 * 60); return($ttl); } function out_time ( $seconds , $mode = false) { $uday = (3600 * 24); $uhr = 3600; $umin = 60; if ($seconds < 0 ) { $neg = "-" ; $seconds = $seconds * -1 ; //echo "Seconds = " . $seconds . "
"; } else { $neg = "" ; } // Calculate days $dd = intval($seconds / $uday ); $mmremain = ($seconds - ($dd * $uday)); // Calculate hours $hh = intval($mmremain / $uhr); $ssremain = ($mmremain - ($hh * $uhr)); // Calculate minutes $mm = intval($ssremain / $umin); $ss = ($ssremain - ($mm * $umin)); // If day or days if ($dd == 1) { $days = 'day'; } if ($dd > 1 ) { $days = "days"; } if (!$mode) { // String for if there are days if ( $dd > 0 ) { $out_string = sprintf("%d %s %02d hrs %02d mins", $dd, $days, $hh, $mm); } // String if there are hours if ( $dd == 0 && $hh > 0 ) { $out_string = $neg . sprintf("%d hrs %02d mins", $hh, $mm); } // String if there are minutes if ( $dd == 0 && $hh == 0 && $mm > 0 ) { $out_string = $neg . sprintf("%d mins", $mm); } // Only output Seconds if ( $hh == 0 && $mm == 0 ) { $out_string = $neg . sprintf("%d secs", $ss) ; } } else { // String for if there are days if ( $dd > 0 ) { $out_string = $neg . sprintf("%d:%s %02d:%02d", $dd, $days, $hh, $mm); } // String if there are hours if ( $dd == 0 && $hh > 0 ) { $out_string = $neg . sprintf("%d:%02d", $hh, $mm); } // String if there are minutes if ( $dd == 0 && $hh == 0 && $mm > 0 ) { $out_string = $neg . sprintf("00:%02d", $mm); } // Only output Seconds if ( $hh == 0 && $mm == 0 ) { $out_string = $neg . sprintf("%d secs", $ss) ; } } // Return value return ($out_string); } function time24to12 ($val) { if (strlen($val) == 5 ) { $val .= ":00"; } return( date("g:i", strtotime($val)) ); } $mrise = $clientrawextra[558]; $millum = $clientrawextra[560]; /* CREATE ACTUAL SUN POSITION */ $time = time(); // For testing using http://aa.usno.navy.mil/data/docs/AltAz.php & PHP function date_sun_info() results - (for Jim 90° 4' & 43° 48' & 5 hrs W) /* $testHr = 19; $testMin = 25; $time = mktime($testHr,$testMin,0,date('m'),date('j'),date('Y')); */ $pos = sun_pos($time, $lat, $lon); $az2[0] = $pos[0]; $he2[0] = $pos[1]; // Create the graph. These two calls are always required $graph = new Graph(500,300,"auto",1); $graph->SetMargin(25,20,25,55); $graph->SetBackgroundGradient('blue',$daycolor,GRAD_HOR,BGRAD_PLOT); $suncolor = "yellow"; if ($az2[0] == 180) { $skyword = 'Solar Noon'; } else if ($az2[0] == 360) { $skyword = 'Solar Midnight'; $graph->SetBackgroundGradient('black',$nightcolor,GRAD_HOR,BGRAD_PLOT); } else if ($he2[0] <= 3 && $he2[0] > -1) { // Seems to work out about right $suncolor = "darkorange"; $graph->SetBackgroundGradient('brown',$dawncolor,GRAD_HOR,BGRAD_PLOT); if ($he2[0] >= 0) { // Not sunrise or sunset if ($az2[0] > 180) { $skyword = 'Dusk'; } else { $skyword = 'Dawn'; } } } else if ($he2[0] == -1) { $suncolor = "darkorange"; $graph->SetBackgroundGradient('brown',$dawncolor,GRAD_HOR,BGRAD_PLOT); if ($az2[0] > 180) { $skyword = 'Sunset'; } else { $skyword = 'Sunrise'; } } else if ($he2[0] > 0) { if ($az2[0] > 180) { $skyword = 'Afternoon'; } else { $skyword = 'Morning'; } } else if ($he2[0] >= -6) { // Civil Twilight $graph->SetBackgroundGradient('darkorange',$ctlcolor,GRAD_HOR,BGRAD_PLOT); $skyword = 'Civil Twilight'; } else if ($he2[0] >= -12) { // Nautical Twilight $graph->SetBackgroundGradient('black',$ntlcolor,GRAD_HOR,BGRAD_PLOT); $skyword = 'Nautical Twilight'; } else if ($he2[0] >= -18) { // Astronomical Twilight $graph->SetBackgroundGradient('black',$atlcolor,GRAD_HOR,BGRAD_PLOT); $skyword = 'Astronomical Twilight'; } else { // Must be night $graph->SetBackgroundGradient('black',$nightcolor,GRAD_HOR,BGRAD_PLOT); $skyword = 'Nighttime'; } $graph->SetMarginColor("black"); $fecha = date($dtstring, time()) . " local time"; $graph->SetClipping(); $graph->SetScale( "linlin",0,90,40,320); $graph ->xgrid->Show( true,true); $graph ->xgrid->SetColor('#99999'); $graph->ygrid->Show(false, false); // $graph ->ygrid->Show( true,true); // Prevents background color from displaying!!!! $graph ->ygrid->SetColor('#99999'); $graph->setTickDensity(TICKD_NORMAL,TICKD_DENSE); $graph->xaxis->SetPos("min"); $graph->legend->Hide(); $graph->xaxis->title->SetFont(FF_ARIAL,FS_BOLD,8); $graph->xaxis->title->SetColor("orange"); $graph->xaxis->title->Set("Sun AZ: $az2[0]° Zenith: $zen Sun EL: $he2[0]°"); $graph->xaxis->SetTitleMargin(10); $graph->yaxis->SetFont(FF_ARIAL,FS_BOLD,7); $graph->yaxis->SetColor('white'); $graph->xaxis->SetFont(FF_ARIAL,FS_BOLD,7); $graph->xaxis->SetColor('white'); $graph->footer->left->SetFont(FF_ARIAL,FS_BOLD,9); $graph->footer->left->Set("Sunrise: $sr"); $graph->footer->left->SetColor("darkorange"); $graph->footer->center->SetFont(FF_ARIAL,FS_BOLD,9); $graph->footer->center->Set("Sunlight: $dl hrs"); $graph->footer->center->SetColor("darkorange"); $graph->footer->right->SetFont(FF_ARIAL,FS_BOLD,9); $graph->footer->right->Set("Sunset: $ss"); $graph->footer->right->SetColor("darkorange"); // Create the line plot $plot = new LinePlot($he, $az); $plot->SetColor("orange"); $plot->SetWeight(1); $plot->SetStyle('dashed'); // Create the line plot $plot0 = new LinePlot($he0, $az0); $plot0->SetColor("green"); $plot0->SetWeight(1); // Create the line plot $plot1 = new LinePlot($he1, $az1); $plot1->SetColor("magenta"); $plot1->SetWeight(1); // Create the line plot $plot2 = new LinePlot($he3, $az3); $plot2->SetColor("cyan"); $plot2->SetWeight(1); // Create the line plot for Moon path $plot3 = new LinePlot($he61,$tm21); $plot3->SetColor("white"); $plot3->SetWeight(1); $plot3->SetStyle('dashed'); // Top Title $graph->title->Set('Sun/Moon position: '.$fecha.' - '.$skyword); $graph->title->SetFont(FF_ARIAL,FS_BOLD,9); $graph->title->SetColor('orange','black','white'); // Create the scatter plot if ($he2[0] == -1) $he2[0]++; // Push the sun back up on the horizon when at -1 which is sunrise/set $sp1 = new ScatterPlot($he2,$az2); $sp1->mark->SetType(MARK_IMG,'Sun48.png',0.8); // $sp1->mark->SetType(MARK_FILLEDCIRCLE); $sp1->mark->SetWidth(8); $sp1->SetImpuls(); $sp1->mark->SetFillColor($suncolor); $sp1->mark->SetColor($suncolor); $sp2 = new ScatterPlot($he5,$maz); $sp2->mark->SetType(MARK_IMG,'jpmoon.png',0.6); // Add plots to graph $graph->Add($plot0); $graph->Add($plot1); $graph->Add($plot2); $graph->Add($plot3); //Moon $graph->Add($plot); if($he2[0]>-1)$graph->Add($sp1); $graph->Add($sp2); // Add labels for equinox peaks $txt =new Text("Jun 21"); $txt->SetFont(FF_ARIAL,FS_BOLD,7); $txt->SetPos( 237,40); $txt->SetColor( "green"); $graph->AddText($txt); $txt1 =new Text("Dec 21"); $txt1->SetFont(FF_ARIAL,FS_BOLD,7); $txt1->SetPos( 237,173); $txt1->SetColor( "magenta"); $graph->AddText($txt1); $txt2 =new Text("Equinox"); $txt2->SetFont(FF_ARIAL,FS_BOLD,7); $txt2->SetPos( 233,96); $txt2->SetColor( "cyan"); $graph->AddText($txt2); $txt3 =new Text("Moon EL: $he5[0]°"); $txt3->SetFont(FF_ARIAL,FS_BOLD,8); $txt3->SetPos(408,276); $txt3->SetColor( "white"); $graph->AddText($txt3); $txt4 =new Text("Moonrise: $mrise"); $txt4->SetFont(FF_ARIAL,FS_BOLD,8); $txt4->SetPos(15,276); $txt4->SetColor( "white"); $graph->AddText($txt4); $txt5 =new Text("Illumination: $millum%"); $txt5->SetFont(FF_ARIAL,FS_BOLD,8); $txt5->SetPos(208,276); $txt5->SetColor( "white"); $graph->AddText($txt5); // Save the graph $graph->Stroke(); ?>