use of com.github.amsacode.predict4java.SatPos in project adif-processor by urbancamo.
the class NoradSatellite method getPosition.
@Override
public GlobalCoords3D getPosition(GlobalCoords3D coords, LocalDate date, LocalTime time) {
GroundStationPosition groundStationPosition = new GroundStationPosition(coords.getLatitude(), coords.getLongitude(), coords.getAltitude());
LocalDateTime dateTime = LocalDateTime.of(date, time);
ZonedDateTime utcDateTime = dateTime.atZone(ZoneId.of("UTC"));
Date utcDate = new Date(utcDateTime.toInstant().toEpochMilli());
SatPos satPos = satellite.getPosition(groundStationPosition, utcDate);
double latitude = satPos.getLatitude() / (Math.PI * 2.0) * 360;
double longitude = satPos.getLongitude() / (Math.PI * 2.0) * 360;
double altitudeInMetres = satPos.getAltitude() * 1000.0;
return new GlobalCoords3D(latitude, longitude, altitudeInMetres, LocationSource.SATELLITE, LocationAccuracy.LAT_LONG);
}
Aggregations