Qgis 里的Python脚本介绍,自我介绍拍摄脚本,QGIS 入门演示之


QGIS 入门演示之《用 QGIS 画矢量交通路线图》

脚本编程之准备知识《Python 教程》

QGIS API

QGIS插件库

运行QGIS脚本,对于桌面应用来讲有4种方式:

QGIS 启动时自动运行Python脚本QGIS 控制台中运行发布的Python命令创建Python写的插件创建基于QGIS API的应用程序

QGIS服务端绑定:

2.8 开始,QGIS服务端包含Python插件 (see:Server Python Plugins)2.11开始 (2015-08-11), QGIS 服务库包含Python 绑定,可以在Python应用中嵌入QGIS服务。

1、 启动脚本

启动脚本可以通过指定环境变量PYQGIS_STARTUP来指定启动时运行的脚本。也可以编辑位于安装目录.qgis2/python/startup.py 文件。

2、控制台

通过菜单:Plugins ? Python Console 来打开。

技术分享

3、插件

《如何创建插件》

4、应用程序

1) 独立脚本

使用PyQGIS 来创建脚本

from qgis.core import *# supply path to qgis install locationQgsApplication.setPrefixPath("/path/to/qgis/installation", True)# create a reference to the QgsApplication, setting the# second argument to False disables the GUIqgs = QgsApplication([], False)# load providersqgs.initQgis()# Write your code here to load some layers, use processing algorithms, etc.# When your s

2)自定义程序

from qgis.core import *# supply path to qgis install locationQgsApplication.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 applicationqgs = QgsApplication([], True)# load providersqgs.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 memoryqgs.exitQgis()

Qgis 里的Python脚本介绍

评论关闭