4 votes
Accepted

Setting up thread with busy progress indicator or GIF in PyQGIS

As in my answer in the post you linked, I create a QgsTask MyTask with a layer parameter. I just adapt the content of your method buffering in the run method of the QgsTask. I defined 2 signals (...
user avatar
  • 11.7k
4 votes

Placing plugin or action in submenu using PyQGIS or PyQT

It can be improved (tests, search of the submenu text) but the code below will add your action in the right Geoprocessing Tools submenu : def add_plugin_to_geoprocessing_menu(action: QAction) -> ...
user avatar
  • 11.7k
4 votes
Accepted

Sharing class variables across thread (QgsTasks) with pyQGIS

Here is working example. I have modified your code a bit. Because both your tasks have much the same function (to run a processing algorithm and return a result layer) I would prefer to only create ...
user avatar
  • 13.5k
3 votes
Accepted

Conditional signals in QgsTask managing algorithm output

Try the example below. Sorry, your code was a bit of a mess, I basically tried to make it functional in the quickest way that I could. I suggest to now study the code and do your own research and self ...
user avatar
  • 13.5k
3 votes

Georeferencer QGIS Import jp2 - Export jp2? - Is that possible?

Use the "Generate GDAL script" option of the georeferencer. It will generate two GDAL commands which look about this: gdal_translate -of GTiff -gcp 494827 -7.0126e+06 3 6 -gcp 498813 -7....
user avatar
  • 51.5k
2 votes
Accepted

Get M-value from shapefile by mouse click on canvas

There are two main issues with your code. First one is that QgsMapToolIdentify.identify() will return a list of identified features. So you will need index your result variable before accessing any ...
user avatar
  • 1,384
2 votes
Accepted

QgsAttributeTableView shows nothing in my QGIS plugin

Your class lacks of self, so, at the end of the instantiation (= end of the __init__), the references of the objects without self not binded in other objects of the class are destroyed, so not ...
user avatar
  • 11.7k
2 votes

Tiles XYZ plugin for newer versions of QGIS

So I figured it out. The plugin is now already within the QGIS processing tool box and it is known as Generate XYZ Tiles (MbTiles)
user avatar
1 vote

PyQGIS: moving legend with changed reference point

From your screenshot, it is clear that your legend is being added to your layout, "except for being in the wrong place". You haven't shown or explained how you calculated the layout point ...
user avatar
  • 13.5k
1 vote

Using PyQGIS to buffer the width different than the height of a rectangle

Here a PyQGIS solution for 1 feature : from functools import lru_cache @lru_cache(maxsize=6) def orientation_choices(num_coords: int, axis: str = "x") -> list: if axis == "x&...
user avatar
  • 11.7k
1 vote
Accepted

pyqgis 3 zoom to selected polygon without zooming in so far

I created a quick script with the setCenter method from the QgsMapCanvas class. It allows you to change the extent of the canvas without changing zoom level. It works with Polygons, Lines and Points. ...
user avatar
  • 1,375
1 vote
Accepted

Pyqgis 3 adding polygon vector layer in code and triggering iface.actionAddFeature().trigger() will give me polygons but they cannot be selected

Regarding your first problem I can only assume that you forgot to commit your changes to the underlying data provider. This could be an issue if you iterate through each feature and zoom to it's ...
user avatar
  • 1,384
1 vote
Accepted

triggering add feature action in polygon layer using pyqgis in my plugin, the polygons will not show up, although they are there

I was able to solve this by using this code after creating the polygon layer: myalayer = root.findLayer(self.poly.id()) myClone = myalayer.clone() parent = myalayer.parent() ...
user avatar
  • 75
1 vote

Adding a fixed table to layout in QGIS

Late to the party but an answer composerTitle = 'Layout 1' project = QgsProject.instance() projectLayoutManager = project.layoutManager() # Access to the layout by name layout = projectLayoutManager....
user avatar
  • 28.6k
1 vote

Creating Network Flow Diagram using QGIS

In my opinion, you should start with the telecom project you are working on. Next, for sure you will find the layers you need to include in your network flow schematic. You can follow the steps: ...
user avatar
  • 3,594
1 vote

Adding missing python packages to QGIS Plugin?

The place were the blessed route to a solution will be, if it can be found, is PIP dependencies for Python plugins QGIS enhancement proposal. It's a hard problem to solve. That thread contains ...
user avatar
  • 27.5k

Only top scored, non community-wiki answers of a minimum length are eligible