[英]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.