Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
2 answers
91 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 ...
BenW's user avatar
  • 633
1 vote
2 answers
2k 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 ...
User1228a's user avatar
0 votes
2 answers
437 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 + ...
GIS_GOD's user avatar
  • 399
4 votes
3 answers
992 views

Looping if condition in ArcPy?

I want to use "Calculate field" based on the string in another field. I would like to loop if condition but something is wrong and I am little bit confused. I am super new in Python. Here is my ...
Martin Zápotocký's user avatar
14 votes
5 answers
3k views

Looping through 16 million records using ArcPy?

I have a table with 8 columns and ~16.7 million records. I need to run a set of if-else equations on the columns. I've written a script using UpdateCursor module, but after a few million records it ...
cpt_python's user avatar
3 votes
1 answer
813 views

Speeding up Arcpy script with lots of for loops and cursors?

I'm running this chunk of code (below) inside a larger script. This section is supposed to find the time for each boat (mmsi) that is closest before and closest after a single detection time. It first ...
confused_coder's user avatar
2 votes
1 answer
5k views

Loop through Features in a Layer with ArcPy

I am trying to loop through a list of features in a layer to: select a feature select all features adjacent to that feature export the selection as a new table, then convert it to an excel file. ...
Rae's user avatar
  • 31
0 votes
1 answer
268 views

Loop using SearchCursor and extract by attribute tool

I have multiple rasters with 14 different categories. I want to use SearchCursor to loop through each raster's attribute table, obtain "Value" and use it in ExtractbyAttributes tool. This is the code ...
cpt_python's user avatar
2 votes
1 answer
228 views

Designing Update Cursor that updates rows found between two values?

I am new to python, and have not successfully coded an Update Cursor. I am unable to understand the documentation. I have a geodatabase table of wells that i have built using python. I now want to ...
Casey P.'s user avatar
0 votes
1 answer
5k views

Using Search Cursor to loop through a table and use as variable

I've a fairly extensive script which requires the user to manually define a variable which populates rest of script such as file paths, file names and outputs etc. Now I'm trying get the scrip to loop ...
cpt_python's user avatar
7 votes
3 answers
1k views

Counting in for-loop using ArcPy Cursor?

When using the UpdateCursor, is there a "built-in" way to count within the loop? In the moment I am using a variable i and add 1 after each iteration: cur = arcpy.da.UpdateCursor("points.shp","ID1") ...
Christoph's user avatar
  • 169
3 votes
1 answer
644 views

Exit searchCursor loop after first result

I am attempting to join 2 tables together, and the tools in arcmap, such as add field can't do what I want so I tried using python and arcpy. My approach is to use 2 nested loops and find the values ...
Cristian Iosub's user avatar
0 votes
1 answer
932 views

Looping through a series of arcpy.da. Search and Update cursors

I would like to understand how to loop the following set of data access search and update routines. How do I take the chunk of code below and just loop through it? I need to iterate through the "...
Frederic's user avatar
  • 285
1 vote
1 answer
657 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 ...
M_2210's user avatar
  • 51
3 votes
1 answer
175 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 ...
Hazzamataz's user avatar
1 vote
1 answer
55 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 ...
Patapunfate's user avatar
0 votes
2 answers
2k 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 "...
user1457123's user avatar
2 votes
2 answers
188 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 ...
Beau's user avatar
  • 145
3 votes
2 answers
270 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 ...
Beau's user avatar
  • 145
1 vote
1 answer
384 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 ...
Djb's user avatar
  • 173
2 votes
1 answer
168 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". ...
Patapunfate's user avatar
1 vote
0 answers
44 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 ...
drmackowiak's user avatar
1 vote
1 answer
40 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 ...
user61828's user avatar
0 votes
1 answer
875 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 == ...
pyRsq's user avatar
  • 146
2 votes
2 answers
654 views

Debugging Cursor object has no attribute _exit_ from ArcPy?

I am trying to replace NULL values for -999 in a table inside a gdb. I know how to replace the value for individual fields, but get an error when looping through the complete table. import arcpy fc =...
Iced_'s user avatar
  • 311
2 votes
1 answer
92 views

Mystery duplicate values

I'm using a unique list to populate up to 10 fields for a fc with correct geometry, in an "overloading" manner as you would in excel. I noticed on my first run through I had an "index out of range" ...
Sleep6's user avatar
  • 397
3 votes
2 answers
940 views

arcpy.SearchCursor loops one time but then does not repeat

The part of the script I'm having trouble with is the arcpy.SearchCursor. The cursor runs 1x and then does not re-run. The goal was to re-retrieve the field value and apply it to the image layout. It ...
RustyShackleford's user avatar
2 votes
1 answer
792 views

Updating and inserting a field within the same loop

I am working with an empty feature class where I am writing a script to create polylines within the featureclass and attach an associated text value with the polyline. I am using a for loop as noted ...
Ryan Spencer's user avatar
0 votes
1 answer
2k views

Stop a Cursor loop when only 1 item is selected with Python

I am trying to create a Cursor that goes through a selection process and stops looping when only one feature is selected. Basically, as the Cursor loops it subsets a selection, and instead of going ...
AlmaThom's user avatar
  • 842