[英]How to run python script for QGIS from outside
I have hundred shape files in a folder. 我的文件夹中有一百个形状文件。 I have following tasks 我有以下任务
I can access each layer in python console in QGIS using iface.activeLayer() 我可以使用iface.activeLayer()访问QGIS中python控制台中的每一层
But I want to run a stand alone python script which will perform the tasks. 但是我想运行一个独立的python脚本来执行任务。 Can anyone help? 有人可以帮忙吗?
In my humble opinion, if you want to execute python scripts without the QGIS GUI, you could use the OGR Python API directly. 以我的拙见,如果您想在没有QGIS GUI的情况下执行python脚本,则可以直接使用OGR Python API。
There's an entire "cookbook" here: https://pcjericks.github.io/py-gdalogr-cookbook/ 这里有一个完整的“食谱”: https : //pcjericks.github.io/py-gdalogr-cookbook/
The official API documentation is here: http://gdal.org/python/ 官方API文档在这里: http : //gdal.org/python/
Simple tutorial: http://www.gdal.org/ogr_apitut.html 简单教程: http : //www.gdal.org/ogr_apitut.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.