This assignment will take a file (text) containing the latitudes of airports in Kansas and convert them to degrees. The converted data will be output to an external text file. You will then us another text file which contains the (x,y) coordinates of 12 airports in Kansas and determine the nearest neighbor to each airport. This data will be used to plot a graph of all airports and their relative locations.
Write a function FileDMS2FileDD(dmsFile, ddFile), which reads the latitudes in
text file dmsFile, converts them into decimal degrees, and saves the decimal degrees to the text file ddFile. The text file dmsFile has four columns that are separated by space. The first column is the names of the points and the other 3 columns are the latitudes in degrees, minutes and seconds respectively. The output text file ddFile should have two columns. The first column is the names of the points and the second column is the decimal degrees of the points. You can use the latitudes of twelve Kansas airports in the file KansasAirportLatitudesInDMS.txt to test your function.
Write a function NearestNeighbor(pointsFile, nnpointsFile), which finds the nearest
neighbors for the points in the text file pointsFile and writes the nearest neighbor
information to the text file nnpointsFile. The text file pointsFile has three columns that are separated by comma. The first column is the unique IDs of the points and the other two columns are the x and y coordinates of the points respectively. The output text file
nnpointsFile also has three columns and separated by comma. The first column stores the IDs of the points. The second column stores the IDs of their nearest neighbors and the third column stores the distance to their nearest neighbors. You can use the points in file
Points.txt to test your function.
Using the data file created in the previous function create a plot of the positions of each airport (see example plot).
LBL 37 2 39.153
DDC 37 45 47.225
GCK 37 55 39.065
GBD 38 20 39.905
ICT 37 38 59.869
AAO 37 44 51.196
EWK 38 3 25.593
GLD 39 22 14.225
HYS 38 50 41.771
SLN 38 47 29.335
FOE 38 57 3.436
MHK 39 8 27.502
any help would be greatly appreciated.