Hello All, I am new in Orekit, I want to know passes time of a satellite over an area and area I have defined using SphericalPolygonsSet and to know my satellite is passing this area. I have used GeographicZoneDetector, I have attached below my code so actually I want to know is my approach is correct or I need to use any other detector and It is generating output but how can I verify this for visualisation by any tool or something?
public class VisibilityCheck {
public static void main(String args) {
final File home = new File(System.getProperty(“user.home”));
final File orekitData = new File(home, “orekit-data”);
if (!orekitData.exists()) {
System.err.format(Locale.US, “Failed to find %s folder%n”, orekitData.getAbsolutePath());
System.err.format(Locale.US, “You need to download %s from %s, unzip it in %s and rename it ‘orekit-data’ for this tutorial to work%n”,
“orekit-data-master.zip”, “https://gitlab.orekit.org/orekit/orekit-data/-/archive/master/orekit-data-master.zip”, home.getAbsolutePath());
System.exit(1);
}
final DataProvidersManager manager = DataContext.getDefault().getDataProvidersManager();
manager.addProvider(new DirectoryCrawler(orekitData));
// Load TLE data
String line1 = "1 25544U 98067A 23235.51284918 .00014007 00000-0 25659-3 0 9995";
String line2 = "2 25544 51.6426 355.0105 0003727 342.0009 113.8232 15.49590945412235";
TLE tle = new TLE(line1, line2);
// Create TLE propagator
final Frame satelliteFrame = FramesFactory.getTEME();
final AttitudeProvider attitudeProvider = new LofOffset(satelliteFrame, LOFType.VVLH);
double mass = 419.725;
// Propagator setup
final SGP4 propagator = new SGP4(tle, attitudeProvider, mass, satelliteFrame);
// Earth and frame
final Frame earthFrame = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
final OneAxisEllipsoid earth = new OneAxisEllipsoid(
Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
Constants.WGS84_EARTH_FLATTENING,
earthFrame);
// Define the latitude and longitude arrays
double[] lat = {33.00098474374916, 29.985123674750596, 29.985123674750596, 33.00098474374916};
double[] lon = {72.75124738699935, 72.75124738699935, 78.57760920383606, 78.57760920383606};
// Create S2Point instances for each corner
S2Point point1 = new S2Point(
FastMath.toRadians(lon[0]), FastMath.toRadians(90 - lat[0]));
S2Point point2 = new S2Point(
FastMath.toRadians(lon[1]), FastMath.toRadians(90 - lat[1]));
S2Point point3 = new S2Point(
FastMath.toRadians(lon[2]), FastMath.toRadians(90 - lat[2]));
S2Point point4 = new S2Point(
FastMath.toRadians(lon[3]), FastMath.toRadians(90 - lat[3]));
// Create the SphericalPolygonsSet representing the region of interest (ROI)
SphericalPolygonsSet myAoi = new SphericalPolygonsSet(1.0e-10, point1, point2, point3, point4);
// Zone detector parameters
double margin = 0.1; // Angular margin in radians
GeographicZoneDetector zoneDetector = new GeographicZoneDetector(
earth, myAoi, margin)
.withHandler(new EventHandler<GeographicZoneDetector>() {
AbsoluteDate start = tle.getDate();
@Override
public Action eventOccurred(SpacecraftState s, GeographicZoneDetector detector, boolean increasing) {
if (!increasing) {
final GeodeticPoint satelliteAsGeodeticPoint = earth.transform(s.getPVCoordinates().getPosition(), s.getFrame(), s.getDate());
start = s.getDate(); // Make sure s.getDate() is not null
System.out.format("ENTERED AREA: date: %s Satellite Coordinates: {latitude: %f3.9, longitude: %f3.9, altitude: %f km}\n",
start,
FastMath.toDegrees(satelliteAsGeodeticPoint.getLatitude()),
FastMath.toDegrees(satelliteAsGeodeticPoint.getLongitude()),
(satelliteAsGeodeticPoint.getAltitude() / 1000));
return Action.CONTINUE;
} else {
final double duration = s.getDate().durationFrom(start); // Make sure start is not null
final GeodeticPoint satelliteAsGeodeticPoint = earth.transform(s.getPVCoordinates().getPosition(), s.getFrame(), s.getDate());
System.out.format("Exiting Satellite Coordinates: {latitude: %f3.9, longitude: %f3.9, altitude: %f km}\n",
FastMath.toDegrees(satelliteAsGeodeticPoint.getLatitude()),
FastMath.toDegrees(satelliteAsGeodeticPoint.getLongitude()),
(satelliteAsGeodeticPoint.getAltitude() / 1000));
System.out.format("EXITING AREA: date: %s Pass duration: %f\n", s.getDate(), duration);
return Action.CONTINUE;
}
}
});
propagator.addEventDetector(zoneDetector);
// Propagate from the initial TLE epoch to a specified end time
AbsoluteDate endDate = tle.getDate().shiftedBy(24 * 36000.0); // Propagate for one day
propagator.propagate(tle.getDate(), endDate);
}
}