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

learn more… | top users | synonyms

0
votes
0answers
7 views

Loop Quality layers of Modis in R

I want to parse quality layers of Modis MOD13Q1 in R. I´m using a code from another question here! and it works fine, but i want to loop it for 300 files. I grouped them in stack of rasters and tried ...
3
votes
1answer
58 views

Loop over directory with XTools tool

I'm trying to loop through a directory of shp files with an XTool Pro tool via arcpy. My script successfully performs the operation on the first shp file, but then fails on the rest with a 000584 ...
1
vote
1answer
98 views

error trying to create two variables Cannot acquire a lock

I am trying to create two variables one for x vertices and another for y vertices, when I leave the vertices as x, y the code runs but not when I separate the vertices into verticeX & verticeY ...
1
vote
1answer
41 views

How to apply functions iteratively to SpatialLines in R?

Looking for a way to apply the 'rgeos::gIntersection' and 'rgeos::gDifference' function iteratively to SpatialLines, I created 3 SpatialLines as an example: #from the sp vignette: l1 = cbind(c(1,2,3,...
3
votes
1answer
80 views

How to loop in PostGIS to add the next lat long to a route

I want to loop over the results of a query and then pass row(n)'s longitude, latitude and row(n+1)'s longitude and latitude to another function. I have a query which returns a set of coordinates from ...
1
vote
1answer
51 views

Fill array with coordinates within geographical bounds in Leaflet

I want to create an array and fill it with geographical coordinates I get from a bounds variable. Basically, a for-loop shall create coordinate pairs within the specified bounds with a fixed distance ...
3
votes
1answer
78 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 ...
1
vote
1answer
28 views

Arcpy: Insert a text if filed is empty

I want to run a python code that, if 4 fields are empty, insert in the first of them a text. The fields are all designed to contain text. My code is: import arcpy import xlrd import numpy import ...
0
votes
1answer
57 views

Using InsertCursor and SearchCursor with Nested Loops

I have a script that's parsing through text within each record of a table/field, and inserting those values into field/records of another table. Here's an example of the text being parsed (from "...
2
votes
2answers
71 views

Update Cursor: Unable to populate specific field

I am attempting to create a loop to recognize the entry/exit point of a pipe to/from a structure by associating it with a North, South, East, or West direction and then populate the corresponding ...
2
votes
1answer
45 views

GRASS GIS: how to define several variables in a loop without the command locals()?

I am working on a Python script in GRASS GIS and want define several variables in a loop. My simple loop is working, but I don't know how to integrate sevaral variables. RG_koor=g.read_command("v.out....
1
vote
2answers
48 views

Arcpy fail to loop between files in different directories

I want to perform a loop of intersections between different files in different directories. Here is my code: Intersects = ['Name1','Name2','Name3','Name4','Name5'] #Names of my files arcpy.env....
2
votes
2answers
81 views

Update Cursor for automation of tedious data entry which keeps crashing ArcMap

I coded the Update Cursor for automation of tedious data entry where I am applying a previous Survey Company Identification Data to STRUCTURES_15096.shp from "OFFICIAL_STRUCTURES2015.shp" and it keeps ...
2
votes
2answers
41 views

Use multiple attributes from table to select and merge multiple shape files

I’m totally struggling with a model build in ArcGIS 10.3. Here’s what I’d like to do. Take a table (analysis_table). Iterate over the rows in the table by a unique grouping identifier. From each row,...
1
vote
1answer
49 views

How to do a Loop with a condition in Model Builder?

Can I loop a set of actions in model builder while a specific features rows are 1 or more. Some background: I have a point layer where I've created a workflow that: first selects the row with the ...
3
votes
1answer
66 views

Loop and perform loop in order depending on attribute

I have a lot of points in one layer. All of which represent the same type of real world feature. I want to perform a delete identical within XY of each point but in a specific order. (by splitting ...
0
votes
0answers
12 views

Update XYZ Source for Looping

I'm attempting to update a layer's source to create a looping effect. I've specified a custom tileUrlFunction so that the time delineation is passed in the url appropriately: source: new ol....
1
vote
1answer
70 views

Arcpy get values in the 2nd field of every table in a geodatabase

I have a geodatabase in Oracle with around 50 tables. I want to get the values in the 2nd field of every table in my geodatabase. I will be using the values in the 2nd field as an input for a ...
2
votes
1answer
36 views

Optimise Search within the QGIS API

I would like to ask you about the following code, it works, but I don't think is very helpful to have elif, elif,elif... always. Then, I have to optimise it. The problem is that I can't access to ...
3
votes
1answer
157 views

Not getting correct result from for loop

The for loop below works without error, but the result is get in the table of my database is wrong. Its as if the for loop skips right over the first 3 if and elif statements and goes to the else. The ...
1
vote
1answer
44 views

While loop with Select by location (Add to selection) is not stopping

I have problem with my while loop code. It is not stopping, despite that values used to evaluated the condition to stop the loop are actually met (I can see in in my print statement). Here is the ...
2
votes
1answer
44 views

Arcpy “print” works only the first time [duplicate]

I am running this extremely simple code using the ArcGIS python environment: import arcpy test = r"C:\....\New_Shapefile.shp" #test contains several fields, including one called "Number". ...
0
votes
1answer
87 views

ArcPy Python Addin Combobox How to leave a if-loop, when selection is found

ArcPy Combobox How to leave a if-loop, when selection is found I developed a Combox which: combines values from different featurelayers the User can select an ID or activitycode (acode) the ...
4
votes
1answer
104 views

Creating Python Addin Button?

I want to create a Python AddIn button to execute a specific script. I know how to use the python addIn wizard and add the toolbar I created in my ArcMap. The trouble I am having is writing the script ...
4
votes
4answers
205 views

Get a coordinate system from raster file

I am writing a code to loop through all the files in a folder and reproject them, using a raster as the spatial reference. I have a suspicion that there is a different way to get the coordinate system ...
1
vote
1answer
44 views

Loop through a list and concatenate a string in Arcpy

I'm making a program where the user enters some codes (GetParameterAsText) that are going to be used in a SQL expression to select by atributes. I tried to find similar topics but didn't find a ...
1
vote
1answer
67 views

Spatial join for multiple shapefiles (loop)

I have the following two datasets: polygon shapefile containing administrative boundaries of a City multiple point shapefiles What I want to do is to spatially join the point shapefiles with the ...
0
votes
1answer
61 views

GDAL utility in Bash for loop (Ubuntu) [closed]

In Windows GDAL terminal (in Windows, GDAL has a specific terminal/prompt) I usually do loops and it works like a charm. What I'm trying to do the same in a Shell terminal in Ubuntu with the ...
2
votes
0answers
49 views

Extracting Mean from Raster and Writing to Table in ArcPy?

I am simply trying to extract the mean of each raster within a geodatabase and write the value to a table. I have done this successfully with another set of rasters, but now I keep getting the ...
8
votes
1answer
215 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,...
0
votes
0answers
25 views

A vector object not being replaced in temp folder when using 'for' loop in R

I am currently running GRASS GIS through R interface and got stuck at this point; where I am using a 'for' loop in R, and the code is as follows: for(i in 1:nrow(Snapped_SSP_DSN)) { writeVECT6(...
2
votes
2answers
95 views

ST_Distance loop

I want to create a postgresql function which calculates the distances between random points who are stored in one table. For the Table: CREATE TABLE s_1( id bigserial primary key, the_geom geometry, ...
1
vote
0answers
24 views

Trying to automate clip for multiple polygons based on unique field ID? [duplicate]

I have two feature classes, one that contains all counties for 5 states and the other contains 90 polygons I need clipped only to their pertaining county boundary, but they overlap/ cross the county ...
0
votes
0answers
34 views

Looping all features of cursor onto SQL Server feature class?

It might be me but I've been experiencing something weird. (I actually tried what suggested in this thread Arcpy MakeFeatureLayer won't loop with no luck) What I'm trying to accomplish is to use ...
1
vote
2answers
150 views

Speeding up Python code to convert multiple csv to shapefile?

I am trying to work with some crime data from https://data.police.uk/data/ The data is organised in several .csv files, one for each month and each crime is geocoded with Lat and Long. As the file ...
0
votes
1answer
31 views

Boolean If then statements in ModelBuilder and Repeating model?

I have a large, several step model that iterates through feature classes in a folder taking several time-stamped lat long points and populates several fields in the attribute table. After the model ...
1
vote
1answer
23 views

Create Separate Layers by Category

I'm trying to create a layer for each county (based on a layer of all counties) and join only those census tracts located in that county. However, the result I'm getting is a layer named for each ...
5
votes
1answer
96 views

Loop NDVI calculations for hyperspectral datacubes in R

I am writing a script for the processing of different hyperspectral datacubes. The datacubes contain flight lines that I've recorded with a UAV. In total there are 10 flight lines that need to be ...
3
votes
1answer
72 views

Finding Points in Polygons with Matching ID's?

I'm fairly new to using PyQgis, so sorry if this question is basic. I'm working with two vector layers: (layer 1) A series of polygons, each with an ID field specifying what geographic district the ...
0
votes
1answer
70 views

arcpy iterating field names, values to create new feature classes

I want to create new feature classes based on selections from a list of fields. For now I'm using a user prompt instead of GetParamatersAsText for the selection criteria. I need the script to look for ...
3
votes
1answer
185 views

Problems with nested loops - How to start from 0?

I have : 12 lines feature classes (lineFC) A polygon feature class (grid) Another polygon feature class with much bigger polygons (gridDivision) The process: Select one lines FC from a list ...
0
votes
1answer
43 views

Looping output as new input many times (50+) in ModelBuilder?

I want to run focal statistics on a raster, then run focal statistics (same configuration/setup as the first focal stat.) again on the output, and again on the new output, and again, and again. ...
0
votes
1answer
48 views

Boolean GetParameterAsText in a loop

I have this tool where the user inputs an ID number and the tool selects a list of features applies symbology (.lyr) and adds the queried features to the open mxd. # Import modules import arcpy ...
1
vote
1answer
275 views

Using Loop for calculating NDVI

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

How do I keep my python loop going if there is an error with an SDE workspace?

I have a folder with several .SDE connections. I want my Python code to execute various SDE maintenance procedures (such as compress) on each of these databases. If there is a bad/corrupt/not ...
0
votes
1answer
256 views

Unknown Error? - A Column was specified that does not exist

shps = [(shp1,"field1"), (shp2,"field2")] for item in shps: shp = item[0] field = item[1] for row in arcpy.SearchCursor(shp, fields='"{0}"'.format(field)): if row == ...
3
votes
1answer
195 views

Loop to check multiple polygons overlap in r

I have a set of polygons (available here: http://ulozto.cz/x39ELbFt/polygons-zip) created in QGis and processed in R. I would like to know if they are overlapping or not, and if yes, where is the ...
2
votes
1answer
300 views

Loop through columns Python arcpy.ListFields

I am trying to run a Python script that loops through all fields in my input feature attribute table. I have searched extensively and tried to use arcpy.ListField to work but it seems all people got ...
1
vote
0answers
133 views

How to accelerate my python looping process for A-star path finding on DEM surface?

I try to make an A-star Path Finding program base on tile-graph (image raster data as graph) where each pixel values represent as cost and elevation.. In my case, DEM raster data was called by using ...
0
votes
1answer
147 views

How to add multiple fields to many Feature class using Arcpy

I have a geodatabase with multiple Feature Class (at least 100). I would like to add in each attribute table of each Feature Class, two new columns. I have to do that with a python script because it ...