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.
6
votes
Getting field index from input vector layer in PyQGIS
fieldNameIndex function was removed in QGIS3:
Removed fieldNameIndex(), use fields().lookupField() or
fields().indexFromName() instead
You can convert your code as follows:
inEdges = self.par …
4
votes
Accepted
Multiple styles using pyqgis
You should obtain the style manager from layer instead of creating new one. You can do this with:
layer.styleManager()
You can read more in QGIS documentation:
https://qgis.org/api/classQgsMapLayer …
1
vote
How to get labels to show from a python plugin in QGIS?
You want to show expression based label, so you have to set:
label.isExpression = True
and for visible labels (non blocking) you have to set:
label.drawLabels = True
Tested on QGIS 2.18.22
6
votes
QGIS 3.4 Madeira crashes when calling print()
Don't use print in QGIS3 processing algorithms. Explanation from QGIS processing guide draft:
Give feedback via the feedback object, not directly to QgsMessageLog
(and avoid print statements - t …
1
vote
Accepted
Plugin that selects closest point features from a mouse click
Your layerData list contains tuples not the QgsFeatureIds required to select features, simple fix will be:
selected_fid = []
for (layer, closestFeatureId, shortestDistance) in layerData:
…
4
votes
QGIS stopEditing function in python
QgsVectorLayerTools instance is exposed by QgisInterface (iface), you can stop editing with:
iface.vectorLayerTools().stopEditing(layer,False)
iface.vectorLayerTools() by default returns QgsGuiVect …