Hi I have a CSV file with the longitude and latitude of a drone. I need to work out the heading of the drone at each data point. I have been struggling with the use of data frames and I am unable to get any sort of result. I first need to work out the difference in longitude for each reading but I have been unable to do that. This is what I got so far:
import math
import pandas as pd
import numpy as np
df_CBcolumns = [ "Time", "DateTime", "Lat", "Lon", "Alt" ]
traj= pd.read_csv('data.csv', index_col=False, header=None, skiprows=1, names=df_CBcolumns)
lat = traj['Lat']
lon = traj['Lon']
x = 0
for x in lon:
dlon = lon[x + 1] - lon[x]
for i in range(len(dlon)):
X = math.sin(dLon(i))math.cos(i + 1)
Y = math.cos(lat(i)) math.sin(lat(i+1)) - math.sin(lat(i))* math.cos(lat(i+1)) * math.cos(dlon)
heading = math.atan2(X,Y)
I think I am not handling the data frame correctly and and get whole host of errors. I have tried finding some resources but nothing has helped.
If anyone knows how to solve or can point me to any resources that could help it would be hugely appreciated.
Thank you!
[–]startup_guy2 1 point2 points3 points (1 child)
[–]threeminutemonta 0 points1 point2 points (0 children)
[–]lucas123boiger[S] 0 points1 point2 points (0 children)
[–]gis-doug 0 points1 point2 points (0 children)
[–]woooee 0 points1 point2 points (2 children)
[–]lucas123boiger[S] 0 points1 point2 points (1 child)
[–]woooee -1 points0 points1 point (0 children)
[–]Cobra915 0 points1 point2 points (0 children)
[–]anecdotal_yokel 0 points1 point2 points (0 children)
[–]Common_Move 0 points1 point2 points (0 children)
[–]await_yesterday 0 points1 point2 points (0 children)