简体   繁体   中英

writing python script to automate QGIS (Qt) tasks

I am using QGIS to do some repetitive mapping work. I have a floor plan of an elderly home which is digitized into QGIS with the bed numbers properly labeled, and a spreadsheet with the bed numbers and all the other attributes that belong to that bed.

I need to create multiple layers and visualize them one by one, currently I am using the 'save as image' function. It's OK if I only need to work on it once however I have >30 elderly homes, and 4-5 layers for each home to visualize. QGIS is already a lot better than ArcGIS, but I still feel a bit overwhelmed when I realize that I need to do them all manually.

I am looking to Python for automation, but seems it is mainly used in QGIS for creating plugins.

Being an R user I am used to automating all repetitive tasks.

I know that QGIS is written using Qt4, Does anyone have knowledge of a QT4 script that I can use as a model to automate QGIS?

Can anyone tell me whether it is possible, and if yes, how?

Thanks.

If you just want to execute a script, have a look at the Python Console (Plugins->Python Console).

Also consider writing a QGIS Python plugin. It's really easy.

Besides these two options, you can also use qgis as a Python library completely outside of QGIS (eg as a commandline script) - but I don't know if that's what you're looking for. The excellent PyQIS cookbook calls this "Python Applications"

http://www.qgis.org/pyqgis-cookbook/intro.html

It's all open source, so if you look to the extensive QGIS Python plugin repositories, you can simply look for a plugin that does similar things like you have in mind and use that code as a template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM