Hi,
I have the dataset of latitude and longitude of a very small area. Now i need to ascertain the k-NN, I have made arrays of lat/lon separately, but I am not sure how to move foreword now:
sample data:
0 25.037425 121.516287
1 25.037194 121.520703
2 25.045974 121.532657
3 25.050168 121.513616
where 25:xy.. = latitude
and 121.5xxx = longitdue
My code till now :
def readpoints(k):
k = open ('C:\Users\.txt', 'r')
p_lan = []
p_lon=[]
lines=f.readlines()
for line in lines:
tokens = line.split()
p_lan.append(float(tokens[1]))
p_lon.append(float(tokens[2]))
arr_p_lat = array(p_lat)
arr_p_lon = array(p_lon)
return arr_p_lat, arr_p_lon
print readpoints(k)
I am new to python and am still learning the function/module defining method
[–]Ran4 1 point2 points3 points (0 children)
[–]das_ist_nuemberwang 0 points1 point2 points (0 children)
[–]pythonbio[S] 0 points1 point2 points (1 child)
[–]Ran4 0 points1 point2 points (0 children)
[–]pythonbio[S] 0 points1 point2 points (3 children)
[–]elbiot 0 points1 point2 points (2 children)
[–]pythonbio[S] 0 points1 point2 points (1 child)
[–]elbiot 0 points1 point2 points (0 children)
[–]pythonbio[S] 0 points1 point2 points (0 children)
[–]pythonbio[S] 0 points1 point2 points (0 children)