python

Plugin Builder 3.1

We’ve released version 3.1 of the Plugin Builder for QGIS 3.x. This version contains a number of bug fixes and performance enhancements. Here are some of the changes included since version 3.0.3: Fix issue with reload on generated plugins Move dialog creation to run method to improve startup performance Move help file generation files to proper method Include missing tags file Attempt to compile resources.qrc when plugin is generated (requires pyrcc5 in path) Set deployment directory in Makefile based on user OS (pb_tool is recommended over make) Check for valid URL format for tracker and repository Compiling Resource File If you have the resource compiler pyrcc5 in your path, the resource file will be compiled automatically when you generate your new plugin.

Quick Guide to Getting Started with PyQGIS 3 on Windows

Getting started with Python and QGIS 3 can be a bit overwhelming. In this post we give you a quick start to get you up and running and maybe make your PyQGIS life a little easier. There are likely many ways to setup a working PyQGIS development environment—this one works pretty well. Contents Requirements Installing OSGeo4W Setting the Environment pb_tool Working on the Command Line IDE Example Workflow Creating a New Plugin Working with Existing Plugin Code Troubleshooting

Getting Paths with PyQGIS

When writing plugins or scripts it is often necessary to get information about the paths QGIS is using. For example, if we are writing a plugin that uses Python templates to create output based on user actions, we need to know the path to our installed plugin so we can find the templates. Fortunately the API provides an easy way to get at the information; here are a few examples:

New Version of the QGIS Script Runner Plugin

The Script Runner plugin allows you to manage and execute a collection of scripts in QGIS to automate tasks and perform custom processing. Version 0.6 of Script Runner has been released and includes these changes: Arguments can be passed to a script using keyword arguments Script output is logged to the Script Runner window Script output can be logged to disk Preferences dialog allows control of output and logging options Exceptions in scripts are displayed without interfering with console/logging output Context menu (right-click) to access script functions Edit script function uses system default editor or one you specify in preferences For a basic introduction to Script Runner see this post: Script Runner: A Plugin to Run Python Scripts in QGIS

What's New in QGIS Plugins

Here’s a summary of recent additions and updates to plugins in the QGIS repository. FlowMapper (0.1.1) - Generates flow lines between discreet nodes for depicting spatial interaction data (e.g. migration). Query By Example (0.2) - Select features by location. Item Browser (1.6.0) - Browse a multiple selection with auto-zooming to feature and an option to open feature form. Custom Launcher (1.1.0) - Customize your own actions to launch your preferred apps or commands within QGIS.

Script Runner: A Plugin to Run Python Scripts in QGIS

Following up on my last post, Running Scripts in the Python Console, I created a plugin to simplify running scripts: The Script Runner plugin allows you to add your scripts to a list so they are readily available. You can then run them to automate QGIS tasks and have full access to the PyQGIS API. In addition, you can view information about the classes, methods, and functions in your module as well as browse the source:

QGIS: Running Scripts in the Python Console

The QGIS Python console is great for doing one-off tasks or experimenting with the API. Sometimes you might want to automate a task using a script, and do it without writing a full blown plugin. Currently QGIS does not have a way to load an arbitrary Python script and run it.[1] Until it does, this post illustrates a way you can create a script and run it from the console.