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 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

2)自定义程序

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()

最新文章

  1. ubuntu重启搜狗输入法
  2. 不一样的角度 解读微信小程序
  3. Xamarin.Android经验之谈
  4. IOS 集成第三方登录
  5. MyBatis 缓存问题 session
  6. struts2 struts1.x 区别
  7. java 16 - 9 增强for的概述和使用
  8. mysqli报错(HY000/2002)
  9. 文件IO操作
  10. Eclipse 代码提示功能设置。
  11. WebApi学习总结系列第四篇(路由系统)
  12. Java Web系列:Spring依赖注入基础
  13. C#隐藏桌面图标和任务栏
  14. doubango介绍
  15. .Net3月份开发札记
  16. Redis学习笔记之一 : 配置redis
  17. SQL基础知识一
  18. ubuntu14.04 解决屏幕亮度无法调节的问题
  19. Scanner类详解
  20. LwIP Application Developers Manual3---链路层和网络层协议之ARP,IPV4

热门文章

  1. mysql字符集的修改
  2. JAVA中LinkedLockingQueue的简单使用
  3. MyBatis入门篇
  4. SQL Server中建立自定义函数
  5. Django_MTV模型
  6. 快速安装测试版Mysql
  7. Python初学者第八天 元组和字典
  8. 设计模式:桥接(Bridge)模式
  9. php 汉字转拼音函数
  10. g++: error: unrecognized command line option ‘-std=C++11’