Search Results
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 |
Python bindings for QGIS 3.
1
vote
Add PostGIS layer using PyQGIS standalone application
You may try below code (tested with my own database table using data with EPSG 4326)
Some of the code in the sample can help you for other purposes as it was an existing script I've updated to manage …
4
votes
Accepted
How to change a line Symbol layer type using PyQGIS?
Here a standalone recipe. We've seen you are using "Rule-based" symbology. Instead of doing the case for this particular case, we've made the sample for "Single Symbol" and at the end made the transfo …
2
votes
Progress bar does not show progress during processing
Not sure I can help directly but you can run the following as it perfectly shows the progress bar and the progressChanged calls correctly the progress_changed function (tested before answering)
from …
0
votes
Accepted
PyQGIS 3: Pie Charts not rendering, Autogenerate pie SetUpperValue size from expression attr...
Two points:
Look at the following methods as I'm not sure you should use setClassificationField (PS: not certain as only supposed from the API doc)
dr.setClassificationAttributeExpression(strExp)
dr.s …
7
votes
Accepted
Reprojecting QgsPointXY
You can use the following recipe
# Create QgsGeometry from QgsPointXY
geom = QgsGeometry.fromPointXY (QgsPointXY(5,20))
# Prepare crs source and destination and instanciate a transform function
sourc …
8
votes
Accepted
Using SAGA tool in PyQGIS standalone script. Output doesn't return vector layer
If you print the vlayer variable, you will see it's a string referencing the QGIS layer path, so the correction would be the following (standalone, tested with only two separated points layers)
layers …
3
votes
Label from two attributes PyQGIS
You need to add below content (tested)
label_settings.isExpression = True
The QgsPalLayerSettings doc for fieldName states the following
QString QgsPalLayerSettings::fieldName
Name of fiel …
6
votes
Accepted
I need to filter layer by PyQGIS 3
Not sure as your question is not perfectly clear (for me at least) but if you want to filter the layer, use the following
expression = '"id_parroqu"=1'
layer = iface.activeLayer()
layer.setSubsetStri …
3
votes
Accepted
Programmatically removing Annotation items crashes QGIS 3.10
You just need to move your marker = QgsMarkerSymbol.createSimple({"size":"0.1","color":"blue"}) declaration within the loop (tested). Then when cleaning, no problem. It was crashing because you were t …
4
votes
Accepted
Call a QgsMapToolIdentifyFeature mapTool with a button in a QGIS3 plugin
You should change your code by replacing def onFeatureIdentified(feature): with def onFeatureIdentified(self, feature):
If I'm not wrong your onFeatureIdentified is a method of your plugin: it expects …
2
votes
Accepted
Copying attribute values to new layer in QGIS with python
You can remove pr.setAttributes(attrs) line and add after b.setGeometry(buff) the line b.setAttributes(attrs)
You can replace your code alternatively with call to existing processing script for buffe …
2
votes
Accepted
Repeat a QgsLayoutItem on several pages without using atlas
You need to add pages before attempting to move your items. Your current code tries to move items to "non existing pages". A demo below (I start from an existing empty layout named demo_multi with one …
2
votes
Accepted
Publishing a layer as WFS with PyQGIS
It's possible to set the configuration from PyQGIS although it has been a bit annoying to look at the C code to find the keys to write in the QGIS project file (https://github.com/qgis/QGIS/blob/9a0a1 …
1
vote
Make QGIS wait in for loop on condition
Not sure you are choosing the "right" approach. You would better use Qt signals to catch changes in the layer.
from qgis.core import QgsVectorLayer
# create layer
points_layer = QgsVectorLayer("Point …
5
votes
Accepted
How to Enable/Disable Topological Editing Programatically
You can do the following to enable snapping and then topological editing (it happens at QgsProject level):
new_conf = QgsSnappingConfig(QgsProject.instance().snappingConfig())
new_conf.setEnabled(True …