Package: satellite-czml
Satellite CZMLCreates a CZML string based on TLE (Two Line Element set) data for plotting satellites on the open sourceCesiumJSJavaScript library.BackgroundCesiumJS is a WebGL earth modeling engine which allows for time annimated displays of satellites using 3D and 2D interactive maps in the web browser.  A CZML file/string is used by CesiumJS to show a time animation such as in thisexample.  EachTwo-Line Element set (TLE)contains orbit information for a single satellite.  Since satellites drift and maneuver, these become out-of-date and new TLEs must be published.Space-Track.orgis an excellent resource for getting up-to-date and historic TLE data via their free API.  There is also aspacetrackpython package which interfaces with this API for you.Installationpip install satellite-czmlUsageThis library contains two classes to aid in the generation of CZML strings.satellite_czml- Takes either TLE data orsatelliteobjects and builds CZML stringsatellite- Contains the satellite object that will be used in the CZML generationFor a Jupyter notebook example, please look atexample_usage.ipynb.  The notebook also contains an example how to use Plotly Dash with Cesium.Simple Example (one satellite)tle_listmust be a list of lists.  Each element is a TLE entry and each TLE entry is broken up into either two or three elements.  If the TLE entry is only two elements, a separatename_listmust also be provided.fromsatellite_czmlimportsatellite_czmlsingle_tle=[['ISS (ZARYA)','1 25544U 98067A   21016.23305200  .00001366  00000-0  32598-4 0  9992','2 25544  51.6457  14.3113 0000235 231.0982 239.8264 15.49297436265049']]czml_string=satellite_czml(tle_list=single_tle).get_czml()Multiple Satellite ExampleThe same works method works whith multiple TLE entriesfromsatellite_czmlimportsatellite_czmlczml_string=satellite_czml(tle_list=multiple_tle).get_czml()Specifying Argument Listsfromsatellite_czmlimportsatellite_czmlfromdatetimeimportdatetime,timedeltaimportrandomname_list=[t[0]fortinmultiple_tle]description_list=['Station: '+t[0]fortinmultiple_tle]color_list=[[random.randrange(256)forxinrange(3)]forxinrange(len(multiple_tle))]size_list=[7]*len(multiple_tle)czml_obj=satellite_czml(tle_list=multiple_tle,name_list=name_list,description_list=description_list,color_list=color_list,speed_multiplier=1,use_default_image=False,marker_scale_list=size_list,show_label=False,show_path=False,ignore_bad_tles=True)czml_string=czml_obj.get_czml()Create Satellites One-by-Onefromsatellite_czmlimportsatellite_czmlfromsatellite_czmlimportsatellitemultiple_sats=[]fortleinsmall_tle_list:sat=satellite(tle,description='Station: '+tle[0],color=[random.randrange(256)forxinrange(3)],marker_scale=12,use_default_image=False,start_time=datetime.strptime('2020-01-01 00:00:00','%Y-%m-%d%H:%M:%S'),end_time=datetime.strptime('2020-01-01 01:00:00','%Y-%m-%d%H:%M:%S'),show_label=True,show_path=True,)multiple_sats.append(sat)czml_obj=satellite_czml(satellite_list=multiple_sats)czml_string=czml_obj.get_czml()Modifying a Satellitebuild_* methods, by default, don't rebuild for performance reasons.  If you've runget_czml()and need to modify satellites, be sure to pass in therebuild=trueparameter like in the below example.# czml_obj from abovelast_sat_key=list(czml_obj.satellites.keys())[-1]last_sat=czml_obj.satellites[last_sat_key]# Change the path to display the orbit pathlast_sat.build_path(rebuild=True,show=True,color=[255,255,0,127],width=3)# Change the label looklast_sat.build_label(rebuild=True,show=True,font='12pt Arial',color=[255,255,0,200],outlineColor=[0,0,0,127],outlineWidth=3,)# Change the marker (billboard)last_sat.build_marker(rebuild=True,size=18,outlineColor=[0,0,0,128],)czml_string=czml_obj.get_czml()Thank YouSpecial thanks toShane Carty,Christian LedermannandBrandon Rhodesfor your work which made this package possible.This is initially based onShane Carty'stle2czmlpython package and uses his motified version ofczml.pyfrom Christian Ledermann.Thanks toChristian Ledermannfor hisczmlpython package and for doing the heavy lifting on the CZML creation.Thanks toBrandon Rhodesfor hissgp4python package and for doing all the complicated orbital calculations so we don't have to.