簡體   English   中英

Qgis Python控制台,計算多邊形中的獨特特征

[英]Qgis Python Console, Count unique features in polygons

您好,我正在使用python控制台計算多邊形圖層中點的唯一特征的數量。 這是我要復制代碼鏈接的鏈接

這是我的代碼:

processing.runalg('qgis:countuniquepointsinpolygon', poly, pts, "fclass", "pt_count", res)

poly是我的多邊形層, pts是我的點層, "fclass"pts層中的字段名稱, "pt_count"將是唯一要素計數將進入的字段, res是將要使用"pt_count"創建的新多邊形"pt_count"字段。

當我運行代碼時,出現以下錯誤:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
NameError: name 'res' is not defined

現場"fclass"pts看起來是這樣的: 圖片

如果應該創建res是否有我為什么會收到此錯誤的原因?

您是否嘗試將文件名作為res傳遞? 例如:

processing.runalg('qgis:countuniquepointsinpolygon', poly, pts, "fclass", "pt_count", "myresult.shp")

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM