标签:com init process xpath algo nal tle python 开始
运行QGIS脚本,对于桌面应用来讲有4种方式:
QGIS服务端绑定:
启动脚本可以通过指定环境变量PYQGIS_STARTUP来指定启动时运行的脚本。也可以编辑位于安装目录.qgis2/python/startup.py 文件。
通过菜单:Plugins ? Python Console 来打开。
《如何创建插件》
使用PyQGIS 来创建脚本
from qgis.core import * # supply path to qgis install location QgsApplication.setPrefixPath("/path/to/qgis/installation", True) # create a reference to the QgsApplication, setting the # second argument to False disables the GUI qgs = QgsApplication([], False) # load providers qgs.initQgis() # Write your code here to load some layers, use processing algorithms, etc. # When your s
from qgis.core import *
# supply path to qgis install location
QgsApplication.setPrefixPath("/path/to/qgis/installation", True)
# create a reference to the QgsApplication
# setting the second argument to True enables the GUI, which we need to do
# since this is a custom application
qgs = QgsApplication([], True)
# load providers
qgs.initQgis()
# Write your code here to load some layers, use processing algorithms, etc.
# When your script is complete, call exitQgis() to remove the provider and
# layer registries from memory
qgs.exitQgis()
标签:com init process xpath algo nal tle python 开始
原文地址:http://www.cnblogs.com/icoolno1/p/7231867.html