Search in sources :

Example 1 with SatPos

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);
}
Also used : SatPos(com.github.amsacode.predict4java.SatPos) GlobalCoords3D(uk.m0nom.coords.GlobalCoords3D) GroundStationPosition(com.github.amsacode.predict4java.GroundStationPosition) Date(java.sql.Date)

Aggregations

GroundStationPosition (com.github.amsacode.predict4java.GroundStationPosition)1 SatPos (com.github.amsacode.predict4java.SatPos)1 Date (java.sql.Date)1 GlobalCoords3D (uk.m0nom.coords.GlobalCoords3D)1