我shapes.txt是這樣的:蟒蛇在列表中找到最接近的值
shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence
100-1-0_D,41.0180673531548,29.085973004423135,0
100-1-0_D,41.018257549826984,29.085232584769567,1
100-1-0_D,41.018438672415755,29.084250285389476,2
100-1-0_D,41.018926081703704,29.082072721166206,3
100-1-0_D,41.019004044993366,29.081607048036684,4
100-1-0_D,41.018951184935545,29.08119023014186,5
...There are thousands of lines like this
我添加到列表「shapes.txt」用這種方法。
with codecs.open('/home/fatih/Desktop/10mart/deneme/shapes.txt', 'r+', encoding='utf8') as veridosya3:
reader3 = csv.reader(veridosya3, delimiter=',', quoting=csv.QUOTE_NONE)
for row3 in reader3:
shapestxt.append(row3)
我有一些coordinat值(緯度,經度)。我需要從shapes.txt找到最接近的緯度,經度值並獲得其序列值。 我該怎麼做?
這個問題很清楚,所以Szabolcs已經很好地回答了。
最接近什麼? –