sgp4_sdp4 0.0.1 copy "sgp4_sdp4: ^0.0.1" to clipboard
sgp4_sdp4: ^0.0.1 copied to clipboard

outdated

NORAD SGP4/SDP4 Implementations in Dart

example/lib/main.dart

import 'package:sgp4_sdp4/sgp4_sdp4.dart';

main() {
  /// TLE Example. Getting from https://www.celestrak.com/NORAD/elements/
  const String name = "NOAA 1";
  const String line1 =
      "1 04793U 70106A   21165.13556590 -.00000028  00000-0  10004-3 0  9995";
  const String line2 =
      "2 04793 101.6071 232.4155 0031175 318.8433  69.5245 12.53999256311423";

  /// Get the current date and time
  final dateTime = DateTime.now();

  /// Parse the TLE
  final TLE tleSGP4 = new TLE(name, line1, line2);

  ///Create a orbit object and print if is
  ///SGP4, for "near-Earth" objects, or SDP4 for "deep space" objects.
  final Orbit orbit = new Orbit(tleSGP4);
  print("is SGP4: ${orbit.period() < 255 * 60}");

  /// get the utc time in Julian Day
  ///  + 4/24 need it, diferent time zone (Cuba -4 hrs )
  final double utcTime = Julian.fromFullDate(dateTime.year, dateTime.month,
              dateTime.day, dateTime.hour, dateTime.minute)
          .getDate() +
      4 / 24.0;

  final Eci eciPos =
      orbit.getPosition((utcTime - orbit.epoch().getDate()) * MIN_PER_DAY);

  ///Get the current lat, lng of the satellite
  final CoordGeo coord = eciPos.toGeo();
  if (coord.lon > PI) coord.lon -= TWOPI;

  print("lat: ${rad2deg(coord.lat)}  lng: ${rad2deg(coord.lon)}");
}
6
likes
0
pub points
39%
popularity

Publisher

unverified uploader

NORAD SGP4/SDP4 Implementations in Dart

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on sgp4_sdp4