Questions tagged [cursor]

Cursors are used by database programmers to process individual rows returned by database system queries.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

“RuntimeError: An expected Field was not found or could not be retrieved properly. [temp]” while using SearchCursor

I was trying to convert a .csv table to a geodatabase table and then write some rows that meet some conditions (using sql statement) from the table into a txt file. see the code below. file_path = r'C:...
0
votes
0answers
14 views

Managing schema locks WHILE arcpy.da.UpdateCursor

Managing schema locks while running arcpy.da.UpdateCursor is an example of what I want to do. Generally, I just want to use Python functions in the Python interpreter outside of ArcMap's Python ...
0
votes
0answers
13 views

Remove all old values and update new value in field with arcpy [closed]

I am little bit confused about UpdateCursor because when I use my scripts then its update only the new value in the field, not deleted whole value and update new value in the field I need refresh all ...
1
vote
2answers
24 views

What are considered invalid fieldnames with arcpy Cursor classes?

Using this code, I get the following error. infeature = r"C:\pathto\file.gdb\file" #location of feature class fields = ["Name:", "Location", "Email Address", &...
0
votes
0answers
35 views

ArcPy script extremely slow with Search and Update Cursor

I have developed a Python script to automatically retrieve the maximum height in a certain distance around my input polygon feature class. The height should be calculated for each 5 meters. For a ...
0
votes
1answer
23 views

arcpy.da.SearchCursor keeps running, without any response or error

I am using 'arcpy.da.SearchCursor' in Python script for ArcGIS 10.5, while the script is always keeping running, without any result and error. I use print to see where the problem is; it seems that '...
1
vote
1answer
49 views

Using SearchCursor and UpdateCursor to get multivalues from one table/field to single value of another table/field?

I'm trying to use a combination of arcpy.da.SearchCursor and arcpy.da.UpdateCursor to read and store a couple of values from Table 1 Field A, then insert those values as a single string within Table 2 ...
0
votes
0answers
41 views

Consolidating a one-to-many relationship table to one-to-one based on conditions in ArcPy

Below is an example subset of the attribute table for my data: As shown, I have multiple Point_IDs, and I would like to group them based on their unique value (i.e. Point-ID-1 and Point-ID-2). ...
0
votes
0answers
21 views

TypeError with UpdateCursor on a Field with a Coded Text Domain

Trying to run an arcpy.da.UpdateCursor on a field that has a Coded Text Domain. I keep getting a typeError. Not sure if there's a certain syntax that I need to be using when trying to update the row ...
0
votes
0answers
46 views

Strange “RuntimeError: ERROR 160195: An invalid SQL statement was used”. when trying to debug SearchCursor

I'm trying to get a SearchCursor to function in my script. According to everything I could find, this should have worked. The code reads like this: with arcpy.SearchCursor(sickTrees,'OID@') as cursor: ...
1
vote
1answer
27 views

Delete fields from a table based on Mean calculation using ArcPy

I have an attribute table with 100 columns (values are float and not NULL; more than 3000 rows). Using ArcGIS 10.6 I want to calculate the mean value of every field in a shapefile separately (like ...
2
votes
1answer
20 views

Writing program to get datatypes of certain fields and then do some work on that but SearchCursor makes everything tuples

I am trying to write a program to get the datatypes of certain fields and then do some work on that but SearchCursor makes everything tuples. How do I bypass this situation and get the actual datatype ...
0
votes
1answer
41 views

Using arcpy.da.SearchCursor to sort field in attribute table by ascending order

I am using ArcMap 10.6 with Python 2.7.14 with ArcPy. I want to sort a field named Seq_ID in my attribute table by ascending order using ArcPy. I believe I have to use arcpy.da.SearchCursor. Here is ...
1
vote
0answers
40 views

Why does my arcpy script's da.UpdateCursor get slower the longer it runs?

I have a layer containing pedestrian crosswalks (line features), and two layers containing street data: street segments (line features) and street nodes (point features). Every street segment has a ...
5
votes
3answers
233 views

UpdateCursor RuntimeError: An invalid SQL statement was used

with arcpy.da.UpdateCursor(inFeatures, "[TDS_Name]") as change_cursor: for x in change_cursor: if x[0] == None: x[0] = x[0] else: x[0] = x[0]....
0
votes
1answer
22 views

Not able to update polyline geometry via update cursor

I am trying to read polyline from the feature class and then add a point to the geometry and the update it in the same feature class.... I am able to read it and add the new point...but not able to ...
1
vote
1answer
44 views

Python scripting (update cursor, extract previous row values)

I am new to Python scripting. I would like to use SearchCursor to iterate in each row using the FID as index. Then I would like to evaluate length based on the following conditions: If the length >...
0
votes
1answer
35 views

Checking value of field based on conditional if statement using ArcPy cursors

I'm using ArcGIS desktop 10.6 and executing an arcpy script. I'm creating a script that checks an input shapefiles field values against a set of rules. To do so I've created 2 lists with unique values ...
1
vote
1answer
41 views

Updating Z values on points using UpdateCursor

I have created the following script, which moves the points from my_input_points_fc to my_output_points_fc by user input Furthermore, the z-values in my_output_points_fc should also be updated. ...
0
votes
1answer
42 views

arcpy.da.InsertCursor() Fails with SDE But Works with Local FGDB

I am trying to use arcpy.da.InsertCursor() to insert rows to an SDE table but no rows were added and without any error message. I tried the same code with an exact replica table in a local FGDB and it ...
1
vote
0answers
31 views

UpdateCursor is only updating the first letter from the value of my dictionary [closed]

I am using an update cursor to update an attribute field with the value of my dictionary. Both the field and the value are strings. I am confused why the update cursor is only updating the field ...
1
vote
1answer
25 views

Error using ArcPy SearchCursor to get list of unique values in multiple fields

I'm trying to extract a list of unique values in two fields in a shapefile. I think I am misunderstanding how the search cursor works, because I get the same error on which ever variable (x or y) I ...
1
vote
1answer
106 views

Updating Fields with values from Python list using ArcPy UpdateCursor

I'm currently trying to update the fields of a shapefile, with a list I've compiled outside of the arcpy environment. Trying both UpdateCursor which I can't seem to get to work, and FieldCalculator. ...
2
votes
1answer
42 views

Cursor Select by Location Append Value to List

I have a point layer of Manholes and a point layer of start points for StormSewer pipes. I need to determine where Manholes intersect a start point of a StormSewer pipe (I used the Vertices to Points ...
2
votes
1answer
35 views

Find same names (duplicates) in one field using another feature class field

I have 2 tables (UML, PalmOil) and I would like to check record by record within PalmOil, if there are duplicates intersecting NameUMLwith NamePalmOil UML ID | NameUML | 1 NAME1 2 NAME2 3 ...
1
vote
0answers
24 views

Cursor on selected features [closed]

I'm working on code, and I'm trying to select features by location. After the features are selected, I want the cursor will add "Yes" to "NearPoint3" field, only to the features ...
0
votes
1answer
47 views

Search Cursor cannot access hosted table in ArcGIS Online using Notebooks

I am receive a Runtime Error when using a Search Cursor on a hosted Table in ArcGIS Online and I cannot figure out why. I am using an AGOL Notebook. The message is that it cannot access the Table. ...
0
votes
0answers
25 views

Take first match when encountering a 1-Many relationship when joining with ArcPy Data Access UpdateCursors

My current code is as follows: import arcpy sourceFC = r"C:\Path\SourceFeatureClass" sourceFieldsList = ["JoinField", "ValueField1", "ValueField2", "...
0
votes
2answers
47 views

UpdateCursor is updating empty list correctly but NOT updating data in feature class

I have looked at other posts and am not able to solve my issue. I'm working with Python 2.7 (must use this ver for work). I am trying to reformat labels in an attribute column ("ID") and ...
1
vote
0answers
42 views

Summing range of fields using ArcPy

Using ArcPy, how do I sum a range of fields? While I know this is possible using field calculator, I am looking for something repeatable for long list of fields that changes. I already have code that ...
1
vote
1answer
140 views

Select By Location and Calculate Field in ArcPy

I have a point shapefile and a polygon shapefile and want to set the field "Present" to 1 if it intersects with the polygon in ArcPy, but I am having trouble with the SQL syntax for select ...
0
votes
1answer
54 views

UpdateCursor by unique values from another Field

I am trying to update a field in an attribute table in a feature Layer with arcpy.da.UpdateCursor. I am running the Python script as part of a model in ArcGIS 10.6. But I am lacking some of the basic ...
0
votes
0answers
42 views

Constructing SQL statement for ArcPy SearchCursor

I'm struggling with a real simple cursor problem, and I figure it's probably a syntax issue. But I cannot see what it is. tmpHeader = ['OID@', 'SHAPE@', 'ProjectID','Status','ProjectName','Description'...
1
vote
2answers
109 views

Extracting values of some columns with ArcPy

I've been trying to run some code to extract the values from a column and random sample some of them. The problem is when I try to append values from the cursor to a list. When I append values to the ...
0
votes
1answer
56 views

Python 2.7 stand alone script for compounded with statement. Errors 'column specified does not exist - but it does

I'm writing a standalone Python script to use for labeling ArcMap 10.7 data. (Want to avoid label expressions for portability, etc). I'm attempting to use ID attribute to label based on ADMIN_ORG ...
0
votes
0answers
41 views

Python Calculate Rank in Field Esri

Does anyone know how to calculate the "rank" of a field but within 1-100? For example i have a field called "ValSumBasin" with all these values. I am wanting to rank these values from 1-100. I can ...
0
votes
1answer
46 views

Calculating sum per id using UpdateCursor of ArcPy

I am trying to calculate the SUM value for (VD_SUM) Based on Basin ID and output in the field "VD_SUM_SUM". I am not sure how to write the SUM part at the end. This is what I have so far. import ...
0
votes
1answer
25 views

Insert large list of fields and values into feature class

I want to create a toolbox I have a list of point coordinates, that define a polygon and a list of attributes, that each polygon has. points_list = [(323917.71, 479699.45), (323923.36, 479699.74), (...
1
vote
1answer
35 views

Trouble with syntax of preselection in a cursor

I am trying to determine the maximum values in a column [1] in relation to a column [2]. For this purpose I have written all occurring values of column [2] in a list and now I want to make a selection ...
2
votes
1answer
41 views

StopIteration: iteration not started

I'm trying to update a given field in this case the last one of the table by concatenating all values in the row excepting null values or '' values. So far when execute the code until line: print (...
1
vote
1answer
41 views

Invalid Syntax on Update Cursor update

I'm using a dictionary created by a search cursor from one feature class to update another feature class with an update cursor. I'm getting an invalid syntax error for the cursor.updateRow(row) and.....
2
votes
1answer
82 views

Checking Points within polygon and assigning value using ArcPy

How can I write arcpy code to determine if the points of a point feature class are inside polygons of a polygon feature class and write the result (true/false) to the point FC's attribute field? I ...
1
vote
2answers
113 views

Using arcpy search cursor to relate a .csv and a .shp?

I'm trying to write a script that relates data from a .csv file to a utility pole shape file. Basically, we want the script to iterate through the pole # fields in each table and determine which pole ...
0
votes
0answers
94 views

Iterating through an Index Layer using arcpy ArcGIS Pro

I have one layout and 2 map frames with an index layer. I want to create a map series where frame 1 iterates the odd numbered pages and frame 2 iterates the even numbered pages so it will look like ...
1
vote
1answer
189 views

Using two map frames on one layout in ArcGIS Pro with ArcPy

I want to create a map series that exports two different sheets on one page. For example Page 1 would have sheet 1 & 2 and Page 2 would have sheet 3 & 4. I used to do this with python in ...
1
vote
0answers
33 views

Add Join Management and UpdateCursor in Arcpy

How to join multiple table with shapefile, update cursor specific field of the table in shapefile table and remove the join table? I write some script but it not work, please correct my script. ...
1
vote
2answers
89 views

Making ArcPy code run faster

I have an ArcPy code that I am using to find various characteristics about certain watersheds in Indiana. I start with a shapefile of all 800 watersheds and go through it row by row and perform a ...
0
votes
0answers
24 views

expression for “SelectLayerByAttribute_management” with value of a cursor

I am currently struggling with the correct syntax for a SelectLayerByAttribute_management query, which is created iteratively by a cursor. I want to intersect each municipality from a polygon file ...
0
votes
0answers
55 views

arcpy.da.UpdateCursor with SQL query

I am having issues with my SQL query in the arcpy.da.UpdateCursor(). The code seems to work fine if I remove the SQL query so I am fairly certain that it is the issue. The syntax that I would use in ...
0
votes
0answers
140 views

“IndexError: list index out of range” when trying to add coordinates to an array

I am trying to reconstruct a car's path from some GPS coordinates given in a CSV file. I created an empty array to add the X and Y values (lat, long) and create the lines using it but I am getting an ...

1
2 3 4 5
19