A partial PHP port of the Gpredict program for real-time satellite tracking and orbit prediction.
PHP JavaScript CSS
Latest commit 806c835 Mar 21, 2014 @shupp Fixed bug in Predict_TLE::__construct()
* Some TLEs use leading spaces instead of zeros.  This caused
  the casting of the epoch '14 089.1234234' to '14', wreaking
  havoc on predictions.
* See http://www.celestrak.com/columns/v04n03/ for details on
  the format, and which fields may use leading spaces.
* The original code this was ported from is here as of this
  g_ascii_strtod() is likely what gpredict uses to solve this.



Predict is a partial PHP port of the Gpredict program that allows real-time tracking and orbit prediction of satellites from two line element sets. It supports the SGP4 and SDP4 models for prediction.


Just clone this repo and try out the tests and examples from the root of the checkout.


The tests directory includes a port of the original sgpsdp test files from Gpredict. They are pretty close.

Included in the examples directory is a sample iss.tle (with an update script, which you should run first). There are two examples, the visible_passes.php script and the benchmark.php script. The former is for generating visible pass predictions of the ISS, and its output is similar to what you might get from the Heavens-Above website, and it is heavily commented. The latter just does predictions for benchmarking with xhprof.

You can see an image of a Predict/Google Maps API mash-up I did for fun:

Google Maps Mashup

You can also see an example visible pass plotted from the polar view of the observer:

Google Maps Mashup

About this port

This port largely maintains the style and organization of the original C code, but scopes methods into classes rather than leaving everything in the global scope. The motivation for this is so that changes upstream can more easily be integrated over time. Only the prediction routines have been ported.