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
1answer
72 views

Comparing polygons from zip lists inside a loop, whose data comes from user in Python

I have made a program that calculates area and perimeter based on 2D coordinates (latitude and latitude) given by the user, asking if they want to include more coordinates from the third pair, and ...
4
votes
1answer
91 views

Printing zip lists whose data comes from input user in a loop

Printing zip lists whose data comes from input user in a loop I have made a program that calculates area and perimeter based on 2D coordinates (latitude and latitude) given by the user, asking if they ...
1
vote
0answers
36 views

NetCDF in QGIS --constructing time series using 1368 bands

I have the NetCDF file that contains monthly gridded temperature from 1900 to 2014 (air.mon.mean.v501.nc). The goal is to extract monthly time series for every polygon in my shapefile. Using the US ...
1
vote
0answers
41 views

Export images by loop function in Google Earth Engine (error: invalid JSON)

I want to export data from the FireCCI V51 product in GEE using a loop function for the years 2001 - 2016 for my studyarea. However, when running the code, the error "invalid JSON" appears. ...
2
votes
1answer
39 views

Iterating through attribute in layer to create new layers

I am working on the school project in QGIS, in which I have Price map of the buildings in a vector layer. Each polygon has its price attribute. The maximal value of price is 20 000. I would like to ...
1
vote
0answers
40 views

Creating NDVI tiles from NAIP tiles in R Loop

I have a folder with many 4 band NAIP .tif tiles, band 1 = Red, band 4 = NIR. In R I would like to create/calculate unsigned 8-bit NDVI images for each of the tiles in a folder. I would like to write ...
-1
votes
1answer
63 views

Custom Portal GP Service fails for unexplained reason [closed]

I have written a script to create a smoke plume from user inputs (it draws a giant triangle) and then update a number of structure features that are touched by the smoke plume. It works in ArcMap, but ...
1
vote
0answers
40 views

Use ModelBuilder to project rasters from 600 folders into subfolders in each folder [closed]

I have 600 folders, each folder contains a raster (IMG) and I want to project each raster from one coordinate system to another and generate new folder in the source folder to contain the projected ...
0
votes
1answer
26 views

Google Earth Engine: Sampling through image collection [closed]

I am trying to get samples from each image in an image collection and merge them into a single feature collection. So, I wrote the following code (https://code.earthengine.google.com/...
8
votes
1answer
99 views

Creating multiple buffers in a loop in GEE

I would like to do 50 buffers from a known point. I know to do one by one, but I would like to do in a Loop. Is there any way to do it? This is part of my code: var buff1 = ee.Geometry.Point([-46....
0
votes
2answers
41 views

Getting SyntaxError when trying to loop through shapefiles in folder, calculate Euclidean distance and save files with appended name using ArcPy

I want to loop through shapefiles in a folder, calculate Euclidean distance and then save the files in an output folder with an appended name in arcpy. I want the name to be the filename with "...
0
votes
1answer
30 views

Loop Issue: Extracting mean temps for each layer of RasterStack (NetCDF File)

I am running into a little bit of a problem with a RasterStack loop. I am trying to extract the mean temperature for each county in North Carolina for each hour over the last 10 years. I am able to ...
1
vote
2answers
34 views

ArcPy.da.SearchCursor not cursor-ing

I am using ArcMap 10.8.1. I have shapefiles that are a series of overlapping polygons of drone imagery footprints. I want to loop through each shapefile, and for every shapefile loop through and ...
1
vote
0answers
39 views

Loop through folder and join pairs of files with the same prefix

I have two sets of shapefiles that I would like to join based on a similar field. They are all stored in a path folder which is stored as the variable "steps". One group of shapefiles are ...
2
votes
1answer
58 views

Iteration over features in PyQGIS processing modules

I have an issue with processing.run commands where I would like to do an iteration over features in a layer with polygons. zsj = QgsVectorLayer("/data/grassmaster/testVlado/zsj_ba_test.gpkg",...
0
votes
1answer
54 views

How to apply cdo mask command to loop over multiple .nc files in Python?

I want to use the cdo command for masking the .nc file (the command below): cdo div input.nc maskfile.nc outputfile.nc The command above should be applied over multiple .nc files (looping) in python, ...
0
votes
3answers
79 views

Changing extent of raster in loop using R

I have raster objects of a certain extent (0, 360, -90, 90) and I want to change that extent for all of them to a different extent (-180, 180, -90, 90). The thing is that I have my objects (raster ...
0
votes
0answers
23 views

Python for loop with Boolean input reclassification has a save data bug

So I am creating a script that takes an input soil raster from gSSURGO (Not shown in script as this is part of a larger model). The script is below. import sys, arcpy from arcpy import env from arcpy....
3
votes
1answer
130 views

Using PostGIS to find the overall difference between two (large) polygon datasets

I need to get the Difference of an input layer with ~30k polygons and an overlay layer with ~500k polygons (of which ~200k intersect the input layer). I am trying to learn PostGIS to do this, as it ...
1
vote
0answers
50 views

GEE: How to iterate through a feature collection to calculate annual average indices from MODIS for each feature

I am trying to calculate the average annual vegetation condition index from MODIS data for a set of raions (districts) for spring months (march, april and may). I am wanting to export this data to a ...
2
votes
2answers
51 views

Getting names and numbers in specific vectors from a dataframe in a loop R

I have a huge DataFrame, in which I need to extract some information that generates filenames that I need to search in my working directory later, I also need the value in each cell of the pixel ...
2
votes
2answers
296 views

Iterating over dates to extract precipitation in Google Earth Engine

I'm looking to sum precipitation for a period of 10-days prior to a specified date. This is just an example - in fact, I have around 60 different dates and I don't want to select each the date ...
0
votes
2answers
202 views

Loop through coordinates, adding a marker to the map for each using HERE maps

I am trying to add a number of markers to my map, using HERE maps API. I have my coordinates in a list, and there are 30+ pairs. var coords = [[60.1697768639186, 24.82923586371288], [60....
1
vote
1answer
63 views

Loop for cropping, cloud masking Sentinel 2 L2A images

I have 6 stacks Sentinel 2 images (10m resolution) that I want to crop to my AOI and cloud masking. After which I want to calculate NDVI in R. The stacks are 3 from different months of 2016 and 3 from ...
3
votes
1answer
189 views

How to loop through each feature in a shapefile in Google Earth Engine?

I have written a script which calculates the mean NDVI, NDWI, and NDDI (Normalized Difference Drought Index) values for a given county in a specified time period. These values are then outputted to a ...
0
votes
0answers
49 views

Creating plots for each hour of each day with Python

I am trying to create an animated map (by generating multiple plots) of road traffic throughout a week, where the thickness of roads is represented by the volume of traffic at a specific time of day. ...
1
vote
2answers
115 views

Writing PyQGIS script with operations on multiple set of rasters

I would like to perform a loop that takes from a given folder a set of rasters and for every raster makes the following operation, that in the specific case is the calculation of the monthly ...
3
votes
1answer
80 views

Conditional statement in R based on multiple rasters

I have: raster_1: an integer raster with non-sequential values i (101, 130, 240, 323) i: a watershed discharging X of sediment in the environment raster_2: represents the water quality for each ...
2
votes
1answer
83 views

Error when calculating final polygon after subtracting all intersecting polygons using shapely

This question is a follow-on question from Calculating final polygon after subtracting all intersecting polygons using shapely which was answered. I have a list of centroids that I buffer to 5000 ...
2
votes
1answer
87 views

Calculating final polygon after subtracting all intersecting polygons using shapely [closed]

I have a list of centroids that I buffer to 5000 meters radius. I need to take each resulting circle and run it against the remaining centroids(also buffered to 5000 m) and find the final shape after ...
8
votes
2answers
119 views

Looping with a range of integers for 'numeric' inputs in QGIS Python Console

I have been trying to run r.sun.incidout in a loop of integers (for the 'Day' option, type=integer) in QGIS Python Console. Since the 'day' parameter takes an integer number for its value, I get the ...
1
vote
0answers
48 views

Loop does not run in QGIS action

I tried to create a QGIS action in order to refresh several materialized views at once. for that I wanted to execute a simple loop in my action in order to recover the database where the view will be ...
1
vote
1answer
323 views

Invalid Number Error in Google Earth Engine?

I wrote the below code for sentinel5 data, but returns Invalid Number error in monthly loop. It used to work very well but now shows error. How can I fix it? code link: https://code.earthengine....
0
votes
1answer
79 views

Google earth engine: function to apply code to sequential dates

0 I have a code which creates a value for several different variables for a specific time period (usually over 1 month) and exports these as a csv to my google drive. You can find a link to the code ...
0
votes
1answer
359 views

Execute loop in PostgreSQL query

How to execute for each table in the list one fixed query replacing just %table% in PostgreSQL (like variables and loops) sql = 'select * from $table$ where...some_filter' $table = {tb1, tb2, tb3...}...
1
vote
1answer
63 views

Is there any fast looping through too many shapefiles in a folder using ArcPy?

Looping through shapefile using arcpy.ListFeatureClasses() is very slow for many shapefiles. because first thing first, it writes all in memory as a list and then read each shapefile one by one. Is ...
1
vote
1answer
58 views

Loop through directories and mosaic all raster TIFFs in each dir

I have 200+ directories, each directory contains x amount of TIFFs which I want to mosaic. I have a snip of code that will list the TIFF contents of all dirs under a parent directory, now I just need ...
0
votes
1answer
507 views

Remove Images from Image Collection in Google Earth Engine?

In the below code, I'm going to remove some images from image collection by if condition in .map() instead of filter.neq(), what should I do for this purpose? Map.centerObject(table); Map.addLayer(...
3
votes
2answers
148 views

How QGIS Python loop through all tables MS SQL Server?

I've got Python code on QGIS 3.12 that adds a MS SQL Server data layer to the map, but I need to add all of them. uri = QgsDataSourceUri() uri.setConnection(r"xx.xxx.xxx.xx\xxx", "xxxx&...
1
vote
2answers
320 views

How can I restart the loop or skip the error?

I set up a loop to extract cloudiness in multiple places, but if there is no image in one place in the loop, GEE will report an error.I want to loop to a place where there is no image and the loop can ...
2
votes
1answer
2k views

Call a function multiple times with different argument for date

I need to call the same function 10 times, each time with a different year for the end date argument. For example, the end date needs to start as "2011-01-01", then "2012-01-01", ...
1
vote
1answer
108 views

Creating a Python loop to add up automatically generated rasters on QGIS 3

I'm creating a QGIS 3 program that extracts flow paths from a DTM, then slightly modifies the DTM to extract new flow paths that I want to add to the previous flow path raster. I have used the ...
3
votes
2answers
41 views

Extracting poly.counts through loops using R

I want to extract the count of points over Africa at the first administrative district level at monthly intervals over 26 years. My point data consist of conflict events. I am struggling to figure out ...
0
votes
0answers
162 views

Working around "Unable to allocate memory" error during for-loop in Arcpy

I'm running a very long for-loop in Arcpy (with ArcGIS 10.7 on Win10) over several ten thousand files. It runs smoothly until, everytime after about 3000 iterations (3-4h), it crashes with the error ...
1
vote
1answer
232 views

Recursively find all GeoTIFF in current and subfolders and clip using GDAL

I have thousand of GeoTIFF file in subfolders, and I would like to crop all of them using shapefile and save in a Crop folder. My working directory is: /Data/2000/image_20000101.tif /Data/2000/...
3
votes
1answer
98 views

Iterate through dates and through columns using Model Builder of ArcGIS 10.x

I have a point feature class in a geodatabase (approx 11000 features) with 366 columns. From these, one represents the targeted date and the other 365 represents the temperature of one day of the ...
0
votes
1answer
175 views

R: How to standardise extent of rasters for raster stack

So I'm trying to build a raster stack of 7 variables. In ArcMap I've already standardised resolution and CRS, and I tried to standardise extent and column/row number by extracting by mask with a ...
0
votes
0answers
28 views

Create a loop to run and store the r.stats output of several viewsheds?

I have 15 viewsheds (view 0-14) from which I would like to export the cell count. I can do this for one viewshed through: count=[] i=0 viewshedSize=grass.read_command("r.stats", overwrite=True,flags=...
0
votes
0answers
26 views

Summarizing Continental Biome Data in R

I have written code the produces a mean threshold value for the amount of satellite imagery needed in a single year to produce the 95th percentile of NDVI. I assume that this threshold of satellite ...
1
vote
1answer
202 views

Loop to intersect points with polygons in R for each individual

I have a shapefile with points for 6 individuals and another shapefile with 6 polygons (one per individual). Every individual has the same id in both files. I want to intersect both layers in order ...

1
2 3 4 5
7