首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >pyQgis处理算法

pyQgis处理算法
EN

Stack Overflow用户
提问于 2021-03-18 20:04:13
回答 1查看 299关注 0票数 0
代码语言:javascript
复制
import sys
sys.path.append("c:\\osgeo4w64\\app\qgis\\pyto\\plugins")
    
import processing, os,glob
layer1 = QgsVectorLayer(layer1ShpFilePath, "layer1", "ogr")
layer2 = QgsVectorLayer(layer2ShpFilePath, "layer2", "ogr")
        
params = {
     'INPUT': layer1,
     'OVERLAY': layer2,
     'OUTPUT': "TEST.shp"
}
        
intersectLayer = processing.run("saga:intersect", params)

我想用pyQgis来找出两个矢量层之间的相交多边形,但我总是遇到错误AttributeError:模块'processing‘没有属性'run’谁能帮我?我正在window机器上使用QGis编写python,我已经将基本的QGIS路径添加到环境变量中,但我不确定是否需要将SAGA包添加到窗口环境变量中。

EN

回答 1

Stack Overflow用户

发布于 2021-06-14 05:02:02

我也有同样的问题--可能是因为你在sys.path.append中的导入路径不正确(我在你的帖子里看到了一个拼写错误)。

代码语言:javascript
复制
To check your installation you can type sys.path in qgis console:
Python Console
Use iface to access QGIS API interface or Type help(iface) for more info
Security warning: typing commands from an untrusted source can harm your computer
import sys
sys.path
['/usr/share/qgis/python', '/home/<username>/.local/share/QGIS/QGIS3/profiles/default/python', '/home/<username>/.local/share/QGIS/QGIS3/profiles/default/python/plugins', '/usr/share/qgis/python/plugins', '/usr/lib64/python39.zip', '/usr/lib64/python3.9', '/usr/lib64/python3.9/lib-dynload', '/home/<username>/.local/lib/python3.9/site-packages', '/usr/local/lib/python3.9/site-packages', '/usr/lib64/python3.9/site-packages', '/usr/lib/python3.9/site-packages', '/home/<username>/.local/share/QGIS/QGIS3/profiles/default/python']

万事如意,

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66690762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档