コード例 #1
0
ファイル: JED_track.py プロジェクト: divensje/HMMH_Tools
 def apply_rdp(self, commit=False):
     """ Apply Ramer-Douglas-Peucker Algorithm to reduce number of points in tracks """
     track = []
     for i in range(len(self.x)):
         track.append((self.x[i], self.y[i], self.z[i]))
     rdp_track = rdp3d.rdp(track, 500) # apply rdp (3-dim)
     if commit == False:
         return(rdp_track)
     elif commit == True:
         self.x = []; self.y = []; self.z = []
         for point in rdp_track:
             self.x.append(point[0])
             self.y.append(point[1])
             self.z.append(point[2])
        
         return('Track Updated')
コード例 #2
0
filename = 'C:/Users/Justin/Documents/GitHub/Flight_Track_Visualization/Example_Tracks/apf_tracks.json'

# Import JED_track.py
loader = importlib.machinery.SourceFileLoader('jedtrk','JED_track.py')
jedtrk = loader.load_module('jedtrk')

# Get tracks
tracks = jedtrk.create_tracks(filename)

# Run rdp
pretrack = []
for i in range(len(tracks[0].x)):
    pretrack.append((tracks[0].x[i], tracks[0].y[i], tracks[0].z[i]))

newtrack = rdp(pretrack, 500)

# Plot
pre_x = []
for i in range(len(pretrack)):
    pre_x.append(pretrack[i][0])
pre_y = []
for i in range(len(pretrack)):
    pre_y.append(pretrack[i][1])
pre_z = []
for i in range(len(pretrack)):
    pre_z.append(pretrack[i][2])
    
new_x = []
for i in range(len(newtrack)):
    new_x.append(newtrack[i][0])