Skip to content

Instantly share code, notes, and snippets.

@lizard-isana
Created February 3, 2017 01:12
Show Gist options
  • Save lizard-isana/79153aaaef1533072bf47195acc95445 to your computer and use it in GitHub Desktop.
Save lizard-isana/79153aaaef1533072bf47195acc95445 to your computer and use it in GitHub Desktop.
//introduction to orb.js
// https://github.com/lizard-isana/orb.js
// Planet Position
var date = new Date();
var time = new Orb.Time(date);
var SS = new Orb.SolarSystem();
var mars = new SS.Mars();
var p1 = mars.position.ecliptic(time); // x, y, z
var p2 = mars.position.equatorial(time); // ra, dec, distance
// From Keplarian Elements
var asteroid = new SS.FromKeplarian({
"eccentricity":"0.08728849329001058",
"inclination":"6.812676631845272",
"longitude_of_ascending_node":"250.5660658100269",
"argument_of_periapsis":"95.63473165761138",
"time_of_periapsis":"2456918.756066796",
"semi_major_axis":"1.001911878091084"
});
var p3 = asteroid.position.ecliptic(time); // x, y, z
var p4 = asteroid.position.equatorial(time); // ra, dec, distance
// Artificial Satellites from TLE (TWO LINE ELEMENTS)
var tle = {
first_line:"1 25544U 98067A 15012.59173611 .00014829 00000-0 23845-3 0 7179",
second_line:"2 25544 051.6466 140.7335 0006107 243.2909 291.5211 15.53213268923827"
}
var satellite = new Orb.Satellite(tle);
var p5 = satellite.position.geographic(time); // latitude, longitude, altitude
var p6 = satellite.position.rectangular(time); // x, y, z
// Horizontal Coodinates
var observer = {
"latitude":35.658,
"longitude":139.741,
"altitude":0
}
var obs1 = new Orb.Observation({"observer":observer,"target":mars});
var p7 = obs1.horizontal(time); // azimuth, elevation
// same as artificial satellites
var obs2 = new Orb.Observation({"observer":observer,"target":satellite});
var p8 = obs2.horizontal(time); // azimuth, elevation
// from ra/dec
var obs3 = new Orb.Observation({
"observer":observer ,
"target":{"ra":0,"dec":0}
});
var p9 = obs3.horizontal(time); // azimuth, elevation
// Have fun!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment