Questions tagged [for-loop]
A for-loop statement is a programming loop statement that performs predefined tasks while or until a predetermined condition is met.
                169 questions
            
            
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                58
            
            views
        
        
            
        How to free RAM in my QGIS processing script
                    My PyQGIS script is designed to work on a set of roads, it uses a nested for loop to iterate through each road, prepare a raster based on the line segment's bounds, place points along the line segment,...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                181
            
            views
        
        
            
            
            
        PyQGIS blocking in for statement
                    I have the following PyQGIS script that is a combination of personal edits and graphical modeler:
    cities_layer = self.parameterAsVectorLayer(parameters, 'cities', context)
    urban_area = self....
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                80
            
            views
        
        
            
            
        How to generate sequential numbers for list of input table fields written to a text file (ArcMap script tool)?
                    In order for a script tool I'm writing in ArcMap to read fields in a source CSV correctly as text, I need to automate the writing of a shema.ini file in the source directory. In order to do that I ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                58
            
            views
        
        
            
            
            
        How to iterate through raster conversion concurrently while using map function in Python
                    I am trying to troubleshoot some issues I'm having with the Python map function that is part of a larger problem I'm having with trying to run my code concurrently. Why does map() here create an empty ...
                
            
       
        
            
                6
            
            votes
        
        
            
                3
            
            answers
        
        
            
                583
            
            views
        
        
            
            
            
        Looping every features pair with PyQGIS
                    I need code that loops between each pair of features in sequence (feature 1 with feature 2, feature 2 with feature 3...) but using only a for, I searched the forum and found similar code but with two &...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                58
            
            views
        
        
            
            
            
        Changing strokestyle to no for all point layers in group or project
                    I have 700+ point layers in my project in one group ('Groupname'). All of them have the standard symbology (but different colors). I want to change just the setting of the "stroke style" to &...
                
            
       
        
            
                1
            
            vote
        
        
            
                2
            
            answers
        
        
            
                641
            
            views
        
        
            
            
        Reprojecting each tif located in Folder Directory using GDAL in Python [closed]
                    Python beginner here. I am using python to reproject a folder of rasters (.tifs). Each raster has a projection that I want to change to WGS 1984 (espg:4326). I want to use an open-source GIS library ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                824
            
            views
        
        
            
            
            
        Calculating dNBR for Image Collection in GEE
                    I'm trying to calculate the differenced normalized burn ratio (DNBR) values for a Landsat image collection in Google Earth Engine for detect fire date and measure burned area using the following code; ...
                
            
       
        
            
                0
            
            votes
        
        
            
                2
            
            answers
        
        
            
                430
            
            views
        
        
            
            
            
        Multiply two rasters in R, one raster has stack of 25 images, and another raster has one image
                    I want to multiply two rasters (one has 25 images, and the second raster has 1 image). I am using the loop function for multiplication. But I am not getting the results.
library(raster)
library(rgdal)
...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                366
            
            views
        
        
            
            
        Add result from for loop rasterstats zonal_stats to gpd shapefile attributes as new columns
                    I am trying to use a for loop which would produce the zonal statistics of multiple rasters at shapefile points and then add each raster stat to the shapefile.
I've gotten it to add a column, but I don'...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                132
            
            views
        
        
            
            
            
        Finding the mean of raster layers using for loop in R
                    I am trying to compute the average of raster layers (mean temperature layers) from PRISM data base using a loop.
Number of layers in the stack is 70
tmean10<-list()
tmeanR<-stack(tmean_52_61_R,...
                
            
       
        
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                41
            
            views
        
        
            
            
        Get a list of fields from a list of shapefiles [duplicate]
                    I am trying to get a list of fields from every shapefile in a list I have created that's stored in a variable. My prof says I should be able to call that variable in my if/else statement within my for ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                76
            
            views
        
        
            
            
            
        Iteratively name output files in a loop while using arcpy.conversion.FeatureClassToFeatureClass
                    I have four input feature classes and one feature dataset which I am trying to send them to. I would like the new feature classes to have the same names as the originals. My process is as follows:
for ...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                367
            
            views
        
        
            
            
            
        Select by attribute and location within a for loop? [closed]
                    I have dozens of feature classes in a project geodatabase. I have the code that will identify all the misplaced wells in each dataset, but for the life of me I can't figure out how to get the lines of ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                107
            
            views
        
        
            
            
        Looping GRASS "v.extract" in python
                    I have a multipolygon shapefile representing different cities. I am trying to loop the "v.extract" GRASS command through the different polygons via the Python interface.
This is the code I ...
                
            
       
         
        