Package FlightReportManager :: Module PlotGPSTrack
[hide private]
[frames] | no frames]

Source Code for Module FlightReportManager.PlotGPSTrack

 1  ''' 
 2  Created on 20.03.2017 
 3   
 4  @author: johanneskinzig 
 5   
 6  @description: Use geoplotlib to plot the flight on a map 
 7  ''' 
 8  from DroneDataConversion import DroneDataConversion 
 9   
10 -class PlotGPSTrack():
11 """Plot flight track on a map - plot as a static track"""
12 - def __init__(self, pud_file):
13 ''' 14 Get instances and prepare vars 15 ''' 16 ## normal control flow 17 # get instance 18 flightDataProvider = DroneDataConversion.BebopFlightDataManager(pud_file) 19 # store data 20 self.sec, self.lat, self.lon, self.alt, self.spe, self.bat = flightDataProvider.passFlightData()
21
22 - def prepareDataFrame(self):
23 '''Put data into dictionary; then geoplotlib is able to draw it onto the map''' 24 track_dataframe = {"lat" : self.lat, "lon" : self.lon, "name" : self.sec} 25 return track_dataframe
26
27 - def plotTrackOnMap(self):
28 '''Plot the track onto the map - engine is based on pyglet - right now it is just a point cloud''' 29 import geoplotlib 30 geoplotlib.dot(self.prepareDataFrame()) 31 geoplotlib.show()
32 33
34 - def plotTrackOnMap_MP(self):
35 '''Do the same like PlotTrackOnMap but do it as a separate process. Recommended when calling the method from another GUI library.''' 36 from multiprocessing import Process 37 nproc = Process(target=self.plotTrackOnMap()) 38 nproc.start()
39 40 #class ReflyTrack(): 41 '''Replay/Refly flight on map''' 42 43 44 if __name__ == '__main__': 45 print "Init Done" 46 myflight = PlotGPSTrack("../../DroneDataConversion/DroneDataFiles/BebopTenthFlight_2016_12_10.json") 47 myflight.plotTrackOnMap() 48