编写 python 脚本来自动化 QGIS (Qt) 任务

发布于 2024-12-11 02:30:56 字数 426 浏览 0 评论 0原文

我正在使用 QGIS 来做一些重复性的绘图工作。我有一个老人院的平面图,该平面图被数字化到 QGIS 中,并正确标记了床号,以及一个包含床号和属于该床的所有其他属性的电子表格。

我需要创建多个图层并将它们一一可视化,目前我正在使用“另存为图像”功能。如果我只需要处理一次就可以了,但是我有超过 30 个老人院,每个老人院有 4-5 层可供可视化。 QGIS 已经比 ArcGIS 好很多了,但是当我意识到我需要手动完成这些工作时,我仍然感到有点不知所措。

我正在寻找 Python 来实现自动化,但似乎它主要在 QGIS 中用于创建插件。

作为 R 用户,我习惯于自动化所有重复性任务。

我知道 QGIS 是使用 Qt4 编写的,有谁知道我可以用作自动化 QGIS 模型的 QT4 脚本吗?

谁能告诉我这是否可能,如果可以,如何实现?

谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

顾铮苏瑾 2024-12-18 02:30:56

如果您只想执行脚本,请查看 Python 控制台(插件 -> Python 控制台)。

还可以考虑编写一个 QGIS Python 插件。这真的很容易。

除了这两个选项之外,您还可以将 qgis 用作完全在 QGIS 之外的 Python 库(例如作为命令行脚本) - 但我不知道这是否是您正在寻找的。优秀的 PyQIS 食谱将其称为“Python 应用程序”

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

它都是开源的,所以如果您查看广泛的 QGIS Python 插件存储库,您可以简单地查找一个可以完成您想要的类似操作的插件并使用该代码作为模板。

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 (e.g. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文