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
0
votes
1answer
44 views

Multiple selections with a python loop

I am very new to Python and have no idea about how to write a python loop to do selections for ArcGIS. I already finished writing selection codes with different conditions. Is there anyone helping me ...
1
vote
1answer
31 views

Loop with predict raster function in R [closed]

My data is a dataframe of ALTITUDE in the first column, and monthly temperatures (let's say for a year) in the other columns. I used the following code to create a linear model for each monthly ...
1
vote
2answers
37 views

Use ArcPy for finding value throughout all fields and export to new layer

I need to find a way to find a specific value in the attribute table and then export all rows with said value to a new feature class. Below is the code that I have managed to come up with (using ...
1
vote
0answers
42 views

Extract time series from ImageCollection for multiple points - Google Earth Engine

I have the Sentinel 2 (COPERNICUS/S2) ImageCollection and a FeatureCollection of points. I want to extract a time series for each of the points from the band information in the ImageCollection. So ...
0
votes
1answer
798 views

For loops + boxplot for raster?

I have several Rasterstacks (b1_mask, b2_mask,...) of several layers representing only a determined pixel-intensity range. (So point "A" in some layers is "NA" - in others a "value" of that certain ...
0
votes
1answer
39 views

Make a loop in Google Earth Engine for reduce NDVI from year a months?

I have this code, it generate N ImageCollection and for each image a chart from NDVI in function a the months This is the place of study: var areaEst = ee.FeatureCollection("users/aleszczuk/...
0
votes
2answers
462 views

Creating loop for Lines data (spatial data)?

I am trying to build a lines shapefile with the contour lines from the 20 meters isobath from along the East African coast. This contour line of 20 meters has different segments and I have this ...
0
votes
1answer
35 views

Looping a function over a sequence of parameters with iterate()

I built a function landcov(area, date) to calculate the share of land types 0 to 3 in year "date" from MODIS12Q1 within the polygons of the "area" parameter. I want to use iterate() in a loop-like ...
0
votes
1answer
39 views

gdalwarp for clipping images using multiple polygon in a bash shell for loop

C:\OSGeo4W64\bin\gdalwarp.exe -dstnodata 0 -q -cutline D:\hillsborough_Images_work\split_Polygon\120-140k\Hillborough_FINAL_140000_region_IGD_120570003d29ed0dc.shp -crop_to_cutline -dstalpha -tr 0....
0
votes
1answer
35 views

Didn't show all the column while export the CSV file while using Google Earth Engine

I'm trying to calculate the water areas and the statistics of each band for each water areas to see if there are seasonal changes. The exported .csv file only have the columns ("GNIS_ID","AreaSqKm","...
0
votes
1answer
21 views

Write a text file per image with same name in R

In R I would like to create a text file for each picture I have in a folder and with the same name. By example: Picture 1.png - Picture 1.txt Picture 2.png - Picture 2.txt But the text file name I ...
0
votes
0answers
127 views

Data organization in Google Earth Engine image collection?

I defined an image collection contains all landsat SR images(LT5,LE7 and LC8) only including some specific bands each. Finally 685 images in path 120 and row 32, each contains 10 bands were selected. ...
0
votes
3answers
894 views

Python Delete point in a distance of x meters

I took this code from this source Select maximum number of points more than x meters apart It seems to work for other users, but for me it's an endless loop. I do not understand why, though the code ...
0
votes
2answers
48 views

Loop through a range of rasters and use tool output as input for the next tool run

I'm using the particle track tool and limiting it to a specific trackingtime. For each tool run, I want the rasters input (magnitude and direction) to change to the next rasters in the lists, and the ...
1
vote
1answer
151 views

Iterative Mean of Means Infinite Loop for calculating H-t Index

I'm trying to create a function that will calculate an Ht-Index for Quantifying the Fractal or Scaling Structure of Geographic Features (but am new to R) which basically just finds nested means of ...
1
vote
0answers
32 views

Creating loop in raster algebra which compares each cell to values of other rasters in time series?

I have a list of rasters representing NDVI values (and plan to do similar thing with some other index values as well) and in that raster I also set all values representing clouds to NoData. Now, for ...
2
votes
1answer
41 views

Nested loop and terrain analysis R

I have a raster stack with 11 layers that I am running through a triply nested lapply(). I expect 44 layers to be returned, but I'm only seeing 4! Reproducible example: # Load packages library(...
2
votes
1answer
117 views

ReduceRegion Loop GEE [closed]

I'm trying to loop a ReduceRegion function in Google Earth Engine to obtain a month mean NDVI over a polygon. But I've not been successful yet. I did for one month. At the end, I should have a list ...
1
vote
0answers
32 views

Make a script run indefinitly

I have created a script which reads a JSON file and based on the attributes creates a grid and assigns values to the grid. This JSON file may change. I wanted to create an infinite loop to run the ...
0
votes
1answer
42 views

How do I implement a JSON file with coordinates into a var with featurecollection? (TURF)

I am trying to use the nearest function in TURF, so what I have is a JSON file with information about parkades: { "type" : "FeatureCollection", "name" : "ubcv_parking_www", "features" : [ { ...
1
vote
1answer
75 views

Buffer loop with Python QGIS

I want to iterate a buffer from a list of distances I have, but I can´t find the way to do it. I´m a beginner on Python. import processing x=[100, 200, 300, 400, 500] processing.run("native:buffer",\ ...
2
votes
1answer
137 views

Select all fields from table and use with arcpy.DeleteIdentical_management()?

I would like to use arcpy.DeleteIdentical_management() function without having to specify all fields in the table. Is there a keyword used to select all field in a table? I tried "*" or "ALL" but ...
0
votes
1answer
131 views

Including conditional operation depending on number of images?

I want to do certain operations depending on the number of images in a filtered collection. I am working within a loop, so I need the condition to jump to the next step in the loop given a condition. ...
1
vote
1answer
934 views

How to loop Grass command in Python and put variable in output file

I want to reclassify the same raster several times and then save the file with the value loop variable at the end ... I cannot get it working. import sys import os import atexit ...
0
votes
1answer
270 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 ...
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(): ...
2
votes
2answers
6k views

Loop over features of a GeoJSON object from CartoDB

I have just little knowledge about HTML and JavaScript. Nevertheless I was playing, copying and pasting around with Leaflet and CartoDB. I want to display the features GeoJson in a table. This is ...
0
votes
1answer
36 views

Loop through two raster datasets by order and perform a function

I have two raster datasets that I need to loop through by order and select the first raster from the first dataset with the first raster from the second dataset to perform a function. I keep getting ...
0
votes
1answer
114 views

Export raster over a loop in Google Earth Engine

I would like to export raster in a foreach loop with : var landCover = ee.Image('MODIS/006/MCD12Q1/2016_01_01').select('LC_Prop1'); var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); ...
0
votes
0answers
33 views

Extract values from multiple rasters based on lookup of raster file name

I have 11 raster files (waveheightfiles), and need to extract one value from a different set of coordinates (station) for each raster. I have a list of 11 coordinates (df2) and have used part of the ...
1
vote
2answers
101 views

Looping through a table to allocate kids to nearest school

The general problem is to allocate town's kids to their nearest school and get the distance and the geometry. Tools in use is Postgresql 10.6, PostGIS 2.4.3 and PGRouting 2.5.2 There are three ...
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 ...
1
vote
1answer
79 views

Looping Eliminate tool in Python?

I am very new at Python,I'm not sure if this is even the appropriate way to do what I want to do, but basically, I'm looking to eliminate all of the small polygons in a feature class that was created ...
0
votes
1answer
60 views

Using for loop in least cost path analysis using ArcPy?

I am doing a least cost path analysis. I need to create a for loop that will run 3 times and select the correct weight from each of the two lists (slope and land). Slope = [10, 20, 30] Land = [30, 20,...
0
votes
1answer
370 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
vote
1answer
1k views

Looping through Layers, Add Layer to MXD, Export Image, Repeat, using ArcPy?

ArcGIS 10.2.2 I am trying to loop through a list of layers in a folder, add each layer to an mxd and export an image of the added layer. I have added arcpy.mapping.RemoveLayer to the script to remove ...
1
vote
1answer
244 views

Calculate difference of subsequent images in a collection

how do I call a Specific Image inside a Collection, to loop over it? this is for calculating the difference of images for each set of two subsequent images in a collection dImage= Image(t=i+1)-Image(...
0
votes
2answers
55 views

Arcpy UpdateCursor not Updating, but no Error Reported

Below is the code I'm using in an SDE GDB, on ArcMap 10.4.1: import arcpy # Variables inputAsbuilt = arcpy.GetParameterAsText(0) transmedia = inputAsbuilt + "\\Transmedia" structure = inputAsbuilt + ...
0
votes
0answers
15 views

ogr2ogr loop through feature classes in FGDB except one feature class

I have multiple fgdb and I wanted to merge this to one FGDB and this is the command I used so far find . -path "*/*1*/*.gdb" -o -path "*/*2*/*.gdb" -o -path "*/*3*/*.gdb" \ -o -path "*/*4*/*.gdb" -o -...
1
vote
1answer
3k views

While looping with arcpy: ERROR 010240: Could not save raster dataset?

I am very new to python coding and have been struggling with this for a while I cannot see the reason for this error! Here is the code that is causing this error: import arcpy import numpy as np ...
4
votes
1answer
564 views

Iterate through list of field names and calculate fields with PyQGIS?

I am using QGIS 3.2.1 Bonn 64 bit on Windows 10. I would like to loop through a list of field names and perform calculations on each field. Only the first loop in the iteration performs any ...
0
votes
1answer
81 views

Combining two models, one having an iterator

I have two different ModelBuilder models: Create a new field and split a layer Merge all layers in one folder I want to append both models in one but it does not work. The Model have a loop and I ...
1
vote
1answer
119 views

calculation with raster and numeric values in Loop with R

I want to do some calculations with a list of rasters of lakes. Therefore I wrote a loop, which has so far worked fine when I only used rasters. Now I have calculations with rasters and numeric ...
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 ...
1
vote
1answer
169 views

Creating a Loop in R for averaging Raster values to create time series

I have calculated several different indices for lakes stored as GEOTiff. I now want to write a loop with R to average the values for each lake, so only one value is left for each lake. And then create ...
1
vote
1answer
51 views

Reducing monthly averaged MODIS data over several ROIs

I want to create monthly averages for the MODIS Land Surface Temperature (LST) product for several ROIs. I am able to create an image collection containing the monthly averaged MODIS data, but I have ...
0
votes
2answers
110 views

R: Writing individual variables from a RasterStack in loop

I have a RasterStack with 3 layers each one of them containing 19 variables. Using writeRaster I need to save specific variables into my directory while naming the saved files with the actual variable ...
0
votes
0answers
88 views

Saving rasters in Arcpy loop

I'm trying to do Map Algebra on a bunch of rasters by iterating through a for loop and saving them in an empty geodatabase. However, they aren't saving properly. Only the last raster is created and it ...
1
vote
2answers
259 views

Batch Calculating Indices

I have 111 Landsat8 scenes which I want to calculate several indices for. The algebra to calculate them is most of the time Index= (b1-b2)/(b1+b2). I have the single bands (bands 1-11 respectively) ...
2
votes
0answers
73 views

Map Algebra loop only creating one raster

I'm trying to transform a bunch of rasters in arcpy according to specific functions to create suitability rasters. This portion of the code is supposed to find all the rasters with interpolated ...