Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 135589
0 votes
2 answers
82 views

Add QGSExpression to QGraphicsItem in Layout using PyQGIS

I would like to add and modify and expression for Opacity in a QGraphicsLineItem when I have the item QGraphicsLineItem, it not have a variable to modify the opacity expression Code to get the item: Q …
Jhon Galindo's user avatar
1 vote
Accepted

Add QGSExpression to QGraphicsItem in Layout using PyQGIS

I found the solution to read and modify the opacity expression for any item of the Layout in the following way: items = QgsProject.instance().layoutManager().layouts()[0].items() for item in items: …
Jhon Galindo's user avatar
0 votes

name 'QPrinter' is not defined

You be able to import QPrinter with the following: from qgis.PyQt.QtPrintSupport import QPrinter
Jhon Galindo's user avatar
3 votes

Adding field to PostGIS Layer with PyQGIS

If you need to add a new column in your layer from Postgis, use this: layer = iface.activeLayer() name_column = "new_column" layer.dataProvider().addAttributes([QgsField(name_column, QVariant.Strin …
Jhon Galindo's user avatar
4 votes
Accepted

Removing a group from layers panel using PyQGIS?

You can use this root.removeChildNode(group)
Jhon Galindo's user avatar
0 votes

PyQGIS: how to get a list of all textlabels in my Layout

I notice that the items() return the objects from the layout but some of them return as QT objects that are not manipulable with PyQGIS, so it is not possible to modify and access the properties of all …
Jhon Galindo's user avatar
1 vote

Exporting Geopackage table to directory as CSV with PyQGIS

I think, this code will solve your requirements from osgeo import gdal gdal.VectorTranslate('/path/test.xlsx', '/ruta/the_gpkg_path.gpkg', options='-f XLSX layer1 layer2 layer3') Remember that la …
Jhon Galindo's user avatar
1 vote

Create a polygon from WKT format in PyQGIS

Install QuickWKT Open the plugin QuickWKT Select polygon from WKT Click OK and you will your Polygon If you want to add the polygon from PyQGIS, it is the code that can help you: mem_layer = QgsVectorLayer …
Jhon Galindo's user avatar