[問題] 如何在dbf檔中進行資料比對?

作者: ryoma0915 (芸~)   2014-06-10 22:26:54
我有一個這樣的dbf檔
http://ppt.cc/nupm
AREA X Y id
201144.20807 203500.00000 2535500.00000 2
410470.48979 204500.00000 2535500.00000 2
96374.47460 199500.00000 2533500.00000 2
118790.12873 196500.00000 2531500.00000 2
157389.24175 195500.00000 2530500.00000 2
514871.81518 196500.00000 2530500.00000 2
259449.53306 195500.00000 2529500.00000 2
602155.49015 196500.00000 2529500.00000 2
我想要找出 x y 相同的座標點
然後area 要進行相加
這是我的code
http://pastebin.com/4uwLj83F
想問大家哪裡錯誤呢?
謝謝大家^^
作者: tiefblau (tiefblau)   2014-06-10 22:40:00
你27行的& 是要表達邏輯的and嗎?
作者: ryoma0915 (芸~)   2014-06-10 22:41:00
恩恩 想表達and
作者: tiefblau (tiefblau)   2014-06-10 22:45:00
'&':binary AND operator, 'and':logical AND operator
作者: ryoma0915 (芸~)   2014-06-10 22:49:00
TypeError: range() integer end argument expected,got float. 我一值得到TypeError
作者: Neisseria (Neisseria)   2014-06-10 22:54:00
妳是想找 rec['X'] == rec['Y'] 嗎?不是很懂妳的源碼
作者: ryoma0915 (芸~)   2014-06-10 22:58:00
我想要找(x0,y0) = (x1,y1)就是座標相同的area相加
作者: KSJ (阿真)   2014-06-10 23:03:00
你這是GIS嗎??
作者: ryoma0915 (芸~)   2014-06-10 23:07:00
嗯啊是gis匯出來的資料
作者: KSJ (阿真)   2014-06-10 23:38:00
應該有shp檔吧 建議用postgis/postgresql直接SQL比較方便你的需求是SQL一次搞定的呢~

Links booklink

Contact Us: admin [ a t ] ucptt.com