Predict4java Tutorial – Satellite position in real time

Did you watched sometimes night sky and was wondering what are points seen above you and perhaps you used once application which indicated the positions of the different constellations or other objects? Maybe you would like to create your own applications showing the location of satellites on the sky? If so, this article may interest you.


Above our heads every day are flyaing hundreds of active communications , observation, meteorology, navigation and exploring space or military satellites. However, the position of the satellites can be determined by their TLE indicators. TLE is a record of information about satellite in the form of

0 LANDSAT 8
1 39084U 13008 16168.69890018 .00000098 00000-0 31885-4 0 9995
2 39084 98.2240 238.4076 0001279 94.2262 265.9083 14.57111477177821

TLE contains a lot of informations about the satellite, such as the Norad identifing number,satellite date of launch, the orbit inclination, eccentricity, argument of perigee and many others informations which we can use in the application.
There are also algorithms designed in the 80s of the last century, allowing us to determine the position of the satellites but their implementation is relatively complicated. If you are interested in this topic see http://www.celestrak.com/publications/AIAA/2006-6753/AIAA-2006-6753.pdf But to those that do not plan to recreate the wheel I recommend using Predict4Java.
 
Predict4Java is a free library that allows us to calculate the position of the satellite using the TLE parameters. Libary is possible to download from github repository https://github.com/badgersoftdotcom/predict4java or via Maven if you use it.

The code looks like this:


Date now = new Date();
String threeLineElement[] = new String[3];
threeLineElement[0]="0 LANDSAT 8";
threeLineElement[1]="1 39084U 13008A 16168.69890018 .00000098 00000-0 31885-4 0 9995";
threeLineElement[2]="2 39084 98.2240 238.4076 0001279 94.2262 265.9083 14.57111477177821";

TLE tle = new TLE(threeLineElement);
Satellite sat = uk.me.g4dpz.satellite.SatelliteFactory.createSatellite(tle);
GroundStationPosition GSP = new GroundStationPosition(0,0,0)

Double lat = sat.getPosition(GSP, now).getLatitude()*180.0/Math.PI;
Double long = sat.getPosition(GSP, now).getLongitude()*180.0/Math.PI;
if(long>180.0f){
    long = -(360.0f - long);
}

System.out.println(lat);
System.out.println(long);

First, we create an object reprezenting the current date and array containing TLE data. Using libary predict4java we create TLE object and on the basis we are using the static method createSatellite to create object representing the satellite. Next we create object GroundStationPosition representing ground stations it accepts three parameters latitude, longitude and altitude. When this is done we can acquire the positions of the satellites using getPosition() method in the form of lat and long. In order to present the results on a map we make only a few additional calculations.

 

There are also libaries in C # and C ++ for those who feel more comfortable in these languages:

http://www.zeptomoby.com/satellites/

 

Where to get TLE data?

There are many sites which provide such data. Personally, I recommend https://www.space-track.org it gives us free api containing TLE data as well as numerous information about the satellites themselves.

We should periodically update our TLE data because they are not permanent and they are going to be outdated over time especially when monitoring objects in low orbit. However, we do not have to do this every day, after several weeks the changes are becoming more significant.

 

An example of a more elaborate solutions based on predict4java libary can be seen here:

http://gwiezdny-towarzysz.rhcloud.com

 

Interesting references:

https://pl.wikipedia.org/wiki/TLE

http://www.celestrak.com

http://richiecarmichael.github.io/sat/#

http://apps.agi.com/SatelliteViewer/?Status=Operational

http://www.n2yo.com/?s=41391

Leave a Comment

WordPress Video Lightbox Plugin