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 answers only not deleted user 29431

Repeated execution of some groups of code statements.

2 votes

Running processing workflow in PyQGIS for every selected polygon separately in for loop

You need to select the related feature in every loop and change INPUT value in qgis:randompointsinsidepolygons as in the following script. Otherwise, in every loop the tool uses all features in select …
Kadir Şahbaz's user avatar
26 votes

Iterating over map layers using PyQGIS

For QGIS 3, QgsMapLayerRegistry's functionality has been moved to QgsProject. So, for iterating over map layers, you should use that structure: layers = QgsProject.instance().mapLayers() .mapLaye …
Kadir Şahbaz's user avatar
6 votes

Iterate over features in a model

I don't know if it is possible using actual options in Modeler or Processing window, but you can make a script doing that. from qgis.PyQt.QtCore import QCoreApplication from qgis.core import (QgsProce …
Kadir Şahbaz's user avatar
5 votes
Accepted

Shortest path (point to point) in iteration, safe for the case there is no route

Try something like that: n=0 for f1 in layer1: p1 = f1.geometry().asPoint() x1, y1 = p1.x(), p1.y() coord1= f"{x1},{y1}" for f2 in layer2: p2 = f2.geometry().asPoint() …
Kadir Şahbaz's user avatar
6 votes

Iterate through a list of polygons' centroids in QGIS

In your code, polycent is always set the last polygon's centroid. So you must add centroids to a list. Change your code into that: polycents = [] # empty list for feature in layer.getFeatures(): …
Kadir Şahbaz's user avatar
4 votes

Calculating final polygon after subtracting all intersecting polygons using shapely

Because t would be t coming from previous iteration, not from current iteration. In case of len(new_df) > 1, first block of if statement processes. …
Kadir Şahbaz's user avatar