We’re rewarding the question askers & reputations are being recalculated! Read more.

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.

Filter by
Sorted by
Tagged with
1
vote
1answer
1k views

Append element to an array in Google Earth Engine

I am trying to write a for loop to append elements dynamically to an array. However, the dimensions of the array change on every loop run, throwing off error. var arr = 1 for (var i=0;i<4;++i){ ...
0
votes
1answer
183 views

For Loop not looping correctly - ArcPy

I have four markets 1000-4000, but I only want to do markets 2000 and 3000. I created a markets list only containing those two markets so that I could use the list in a "for" loop. However, when I try ...
-1
votes
1answer
82 views

SQL query new feature within definition within loop of cursor

I am using ArcGIS 10.4.1.5686 and running code within ArcMap. I thought that this question is similar to SQL query new feature with loop, or even Using a for loop to execute a query in arcpy, but ...
1
vote
1answer
56 views

Use results of loop for another raster calculation

I've been looking extensively to find a solution for what I think is a very simple exercise. In general, I would like to know how I can extract a variable from a loop in Python and then use it ...
1
vote
1answer
116 views

Map Automation Script For Looping Help

Working on a Python script that I will run inside of ArcGIS 10.5 that will export PNG maps. Each map will be a different state and for every state there will be 5 different physician specialty types, ...
1
vote
1answer
250 views

For-Looping through Bookmarks in Python Script tool?

I'm using this script tool, in ModelBuilder for ArcGIS Pro, to set up a map layout, reference a bookmark, and export the layout as a PDF. This model iterates through Urgent Care centers and its ...
2
votes
1answer
662 views

How to iterate in a Spatial Polygon Data Frame in R?

I'm trying to iterate in a SpatialPolygonDataFrame that contains 110 features. I tried to use the following code with no success: iterate.spdf = function(x){ for(i in 1:nrow(x)){ p = x[i,...
2
votes
0answers
178 views

Creating instances of QGiS in for loop in standalone python script

I have a Python script which processes data with geographic information. At some stage of my script I need to use an instance of QGiS to make some shapefiles and do some intersects and so on. For now, ...
1
vote
0answers
275 views

Is it possible to list SpatialGridDataFrame files to be used in a loop?

I have a lot (>50) of SpatialGridDataFrame files that I need to turn into raster files, stack with a set of raster files I already have and then extract data from random points from each layer of all ...
1
vote
1answer
716 views

Using Update Cursor in a double for loop in arcpy

I have some problems using a double for loop and getting results written into a geodatabase. I have got a shapefile with polygons (param_polygone) and I want to add data to it, which is stored in a ...
2
votes
1answer
80 views

Iteration through shapefile rows is taking too long

I'am using a shapefile with leaflet in r, where i am iterating through each row of that shapefile with a for loop and then i run an if statement on each of the rows as it iterates through the ...
2
votes
1answer
105 views

Replacing NULL values, loop skips records using Python, OGR, Rtree?

I have a point layer with several NULL values and based on a near analysis with another layer, I would like to replace those NULLs. However, with the code I use it only does a couple and then stops. ...
3
votes
3answers
497 views

Using IF statement in FOR loop? [closed]

I'm trying to use a for loop in a list to assign different buffer widths to the list depending on the length of the line being buffered. I have my list of lengths, and tried to use a for loop to ...
1
vote
1answer
151 views

Loop using Reclassify function: string 'RemapRange' object is not callable

I am a newbie of python teaching myself using the arcpymanual. I am running a Reclassify script on slope grids. It works fine for the first loop then I get an error message for the remap line. I ...
1
vote
1answer
47 views

Continuously changing values in the same band of a multiband raster

I am having issues with continuously changing the values of pixels within a single band of a multiband raster using python 2.7. Essentially, what I am trying to do is continuously change (increment) ...
2
votes
1answer
309 views

Loop for in arcpy: for several rasters, clip with the same shapefile and create an output

I am building an arcpy script, where I would like to create a for loop, that for each raster, it clips it from a shapefile, and creates a new output, with name based on the file itself. The code: ...
0
votes
2answers
153 views

For loop in ModelBuilder?

I have a roads dataset downloaded for Christchurch, New Zealand, from OpenStreetMap. The attribute table contains a column titled 'fclass', which contains the type of road each feature represents (e.g....