Questions tagged [loop]

A sequence of instructions that repeats either a specified number of times or until a particular condition is met.

Filter by
Sorted by
Tagged with
3
votes
3answers
2k views

ArcPy nested loop problem

I have a question connected with ArcPy. I was trying to make a nested loop with 2 cursors - 1st with 2 elements and 2nd with 5 elements. The statement should return 10 connections, e.g. 1-1, 1-2, ... ...
2
votes
2answers
8k views

Looping through list of shapefiles to rename them using ArcPy?

I am trying to upgrade a simple script to list all shapefiles in a folder and if necessary in any folders within and then loop through the list of shapefiles and rename them. import arcpy # Set ...
2
votes
1answer
2k views

Using Loop for calculating NDVI in R?

I am using MOD09Q1 now and I would like to calculating NDVI whole year data. One year, I have 46 band 1 images and 46 band 2 images. list.files I creating list of band 1 and list of band 2. ...
1
vote
2answers
303 views

Using SQL query new feature with loop in ArcPy?

I'm trying to create an individual buffer feature class for each column of an input feature class, where there is a field that contains the buffer distance. I think there is a problem with my SQL ...
13
votes
1answer
3k views

Simplify repetitive tasks in QGIS Graphical Modeler

Are there iterators that can be used in QGIS graphical modeler to simplify the model shown above. If not, is there any better way of simplifying the model? The first column represents my input layers,...
3
votes
2answers
5k views

Handling multiple-extent-problem to create raster stack in R?

I am storing ~ 30 raster files in a folder and want to create a raster stack. I know that not all of these rasters have completely the same extent. They do have the same resolution and CRS. Thus I ...
1
vote
1answer
68 views

ArcGIS ModelBuilder looping wrong tools?

I've created a toolchain in ArcGIS ModelBuilder (see in the picture) But after Creating the "Flow Direction" and the "Iterate field Values" it starts again with the "DEM reconditioning", it's an ...
1
vote
1answer
44 views

Looping through two raster folders to perform raster calculation?

I have two geodatabases with rasters containing information about "treecover" and "loss". The file names are slightly different but can be matched based on the last 8 characters (the coordinates of ...
-2
votes
1answer
204 views

Looping for NDVI in different file paths using R? [closed]

I have different bands separated in different file directory. I used Raster Calculator to calculate NDVI using "NIR1.tif"-"RED1.tif"/"NIR1.tif"+"RED1.tif" as formula. The link below describes a loop ...
5
votes
3answers
7k views

Loop with arcpy.ListFiles

I'm super new on here and have also not much experience with Python but I really like to learn to work with this language. I'm tying to write a script for this: I think I need a for loop instead the '...
3
votes
2answers
1k views

Looping through raster layers in folder with PyQGIS?

I'm looking to apply a mask to a number of rasters in PyQGIS. (updated but still not working) import processing rstr = "/Users/rasterfilepath/" shp = "/Users/shapefile.shp" outputDir = "/Users/output/...
4
votes
1answer
606 views

Improving performance of looping over MXDs using ArcPy?

I am attempting to find the fastest method for looping over multiple map documents while keeping memory resources down. I'm running this script outside of Arcmap 10. I have 5 map documents which are ...
11
votes
2answers
3k views

Stopping PyQGIS script that has infinite loop, using keyboard?

So I wrote a script that does what I want over and over again using a "while True:" in a certain time interval (every 5 seconds using time.sleep(5)). So far so good, BUT when I want to stop it I just ...
5
votes
3answers
2k views

Loop in ModelBuilder for compositing bands of multiple Images

I'm attempting to automate the "Composite Bands" tool somehow in ModelBuilder, but haven't been able to figure out an effective method. I have landsat 7 data that is separated into folders and each ...
2
votes
1answer
899 views

Create a fishnet in a 'for' loop with Arcpy

When running the following script, I get the error saying that I need a value for “origin_coord” and for “y_axis_coord”. So is it not enough to define a template dataset? But how can I fill the “...
5
votes
1answer
1k views

How to do loops on raster cells with python console in QGIS?

I'm new here and beginner with python. I'm looking for a solution to my problem for some hours but now you are my last chance... I'm using the python (2.7.5) console in QGIS (2.4.0). Is there a ...
3
votes
1answer
132 views

Updating attribute information

I need to write a script that updates the "LOCALITY" field in a feature class if it is empty with the suburb it is in. I have identified the number of properties with select by location and the ...
2
votes
2answers
2k views

Python-OGR: nested loop only loops once

I have a polygon file buffer_stands.shp with 20 features and I have a line file OSMroads.geojson with 9 features. I expected the script to loop through the buffers and print out for each buffer loop ...
2
votes
1answer
1k views

Using for loop to execute query in ArcPy?

I'm trying to provide the breakdown of fire detection for an area by sorting of confidence levels. The dataset has 12 files (one for each month in a year) with fire records which all have a column ...
2
votes
1answer
2k views

How to loop through all columns in a table/layer getting all data for a row/feature in MapBasic?

I'm trying to extend this GNU-licensed plugin MI2SVG, which converts MapInfo maps to SVG, so that it writes associated table data into the SVG it creates, so that browser based JS web applications can ...
1
vote
0answers
249 views

Eliminate in Arcpy

I am attempting to move away from Coverages. One of the tools we have did a great job of eliminating slivers from our datasets based on hard and soft boundaries for elimination rulesets; howver, it is ...
1
vote
1answer
1k views

Python Script Zonal Stats as Table Loop Question

I'm trying to write a small script loop script which retrieves rasters from each folder, performs zonal statistics using watershed polygons and saves it as a table. I've written similar loop scripts, ...
1
vote
3answers
4k views

Extracting numbers from string field using Python Parser of ArcMap Field Calculator?

I am trying to calculate field test2 with only the numeric values from a string field test. The entire script is like: def makestr(test) list=[] for s in test: if s.isdigit(): ...
0
votes
2answers
134 views

How can i create points per 10 and 100 meters for several lines with ArcPy?

I have 10 lines and i want to generate points per 10 and 100 meters for each one of them. In ArcGis there is the tool construct points(COGO) but is not scriptable. Is there any suggestion? Also i don'...
0
votes
1answer
880 views

How to create a loop for multiple points with cost distance / cost path in ArcGIS 10.2 in python

I would like to know how to simplify the following code in order to execute it more efficiently than copy paste 82 processes (with a loop I guess?) but I don't know how to do it. There are 4 main ...
0
votes
1answer
313 views

Looping a raster stack with a step, R

I have a large raster stack of about 500 rasterlayers. What I want to do is to extract specific layers and store them in a different strack. The layers for which I am interested in, have a step of 8 ...
0
votes
1answer
395 views

turf.js point never found inside or within GeoJSON features loop

I have a GeoJSON http://radikal.com.mx/distrito.json and all I am trying to do is find if a turf point that has a longitude and latitude is inside or within that GeoJSON. No matter what point I use I ...
-1
votes
1answer
348 views

Same Sector Created in Mapinfo Help

The PRACH data is saved into a tab and then moved into another tab file "ToUpdate" Select * from PRACH_data where Obj into ToUpdate Fetch First From ToUpdate Do While Not EOT(ToUpdate) circ = ...
-1
votes
1answer
55 views

Writing Nested Loops Using SelectLayerByAttribute_management Iteratively over Multiple Fields?

I need to select all rows matching specific values across 3 columns and then iteratively change one value at a time and continue making selections. The reason is to capture certain summary statistics ...