New answers tagged

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.6k
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,546
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.8k
0 votes

QGIS 3.24.1 - Problem Plugin NTv2 Datum Transformations - A failure in the SSL library occurred (_ssl.c:1129)

I was not able o find the reason, so I had to allow unverified ssl with the following code import ssl ssl._create_default_https_context = ssl._create_unverified_context Afterwards the plugin was ...
user avatar
  • 21
0 votes

MMQGIS export shapefile to KML not working, error message: 'Unknown geometry type 0'. But Point data being used?

Before you will use the KML export by the MMQGIS plugin you should reproject your layer. The quickest way to do it is using the "Reproject layer" option in your processing toolbox. As the ...
user avatar
  • 3,546
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.6k
0 votes
Accepted

How to create 3D polygon layer in QGIS 3 or convert 2D layer to 3D similar to PostGIS function ST_Force3d()

Ok I was able to solve this by using this code when saving to file: QgsVectorFileWriter.writeAsVectorFormat(inputlayer, str(outputlayer), "utf-8", QgsCoordinateReferenceSystem("EPSG:...
user avatar
  • 75
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,385
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.6k
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,454
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,454
0 votes

How to Update Plugin Installed Manually (Zip File)

For those still looking for a way to create a proper QGIS repository you have this script that is just perfect: https://gitlab.com/GIS-projects/phpQGISrepository/
user avatar
  • 1,439
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

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

Top 50 recent answers are included