The Sun API

An Excel plug-in that calculates high accuracy solar values according the methods given in the book “Astronomical Algorithms” by Jean Meeus.

SVG Visualisations

A few years ago I created this solar Equation of Time visualisation using a visual basic macro and DeltaCAD:

That was at a time before SVG was supported by any major browser. Today the situation is quite different and it is time to revisit the creation of Visualisations for the web. Is it possible to create a SVG visualisation that is contructed as part of page creation by a PHP script? After many visits to google, I finally found the keys here:

In order to use PHP in conjunction with SVG you have to do two additions in your webservers config-file. We will describe the Apache case, because it is the most-popular webserver. We assume that PHP is already installed and working correctly. First you need to add the type “psvg” to your mime-type file so that the relevant line reads like image/svg+xml svg svgz psvg. The mime-types are usually either located at /etc/mime.types or /etc/httpd/mime.types. Secondly you have to add an additional SVG-handler in the apache config-file, so that your relevant line reads like: AddType application/x-httpd-php .php .php4 .phtml .psvg, assuming you call your php-generated svg-files .psvg.

Stirring stuff! Actually with my bluehost.com control panel adding the mime type and the application type was the work of about 5 minutes.

In addition to adding the mime and application types to my server, I also needed to make sure that the psvg file contained a header() command and that the xml header was printed into the output rather than being plan text:

<?php
header("Content-type: image/svg+xml");
print("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
?>

Unfortunately IE and Firefox cross compatibility issues require the use of the non-standard <embed /> element instead of the recommended <object /> element. Here is the cross browser compatible html to include an svg into a web document:

<embed width="600" height="600" src="eotvisualisation.psvg" NAME="Dynamic EOT Visualisation" type="image/svg+xml" />

Having registered .psvg files with the webserver and sorting out the cross browser issues, the results may be seen in a unique visualisation of the speeding up and slowing down of sun based time throughout the year.

Sunlit Design

I created www.sunlit-design.com as a solar calculation resource site.

  • Very high accuracy freeware solar calculations software that can be used in office programs, CAD programs and as a plug-in for your own programs.
  • Solar calculation terms explained in a helpful way.

Visit www.sunlit-design.com!

Leap Seconds

Some of you will be aware that the rotation of the earth is not at a completely uniform speed. In fact, due to the action of the tides and other forces, the earth is slowing down. (Dr. Richard Sauder has written an interesting summary here. ) The international time standard UTC is linked to the earth’s rotation and this means that UTC occasionally has leap seconds added to it to account for the slowing. The last leap second was added just last January.

[Read more…]