All Questions
Tagged with insertcursor or cursor
1,050 questions
0
votes
1
answer
818
views
Passing ModelBuilder parameter to update cursor gives ERROR 999999?
I have two point layers. I trust the geometry (read: x and y coordinates) from one of them, but not the attributes data. I trust the attribute data but not the geometry from the other one (the ...
0
votes
2
answers
2k
views
RuntimeError: Underlying DBMS error ORA-00936: missing expression schema.tableName STATE_ID is not column in table?
I created a search cursor to retrieve some data from a feature class.
The broken example shown below is used successfully in other scripts I created. The only difference that comes to mind is I'm ...
0
votes
1
answer
766
views
Convert python from arcpy.da.SearchCursor to work in 10.0
I am using code such as
for row in arcpy.da.SearchCursor(polyFC, ["SHAPE@"], spatial_reference=SR):
# create inner buffer
polyBuff = row[0].buffer(buffNum * -1)
# create hull rectangle to ...
0
votes
1
answer
3k
views
ArcGIS 10.1, Python 2.7 "RuntimeError: A column was specified that does not exist. " [closed]
When this error is returned, a problematic column must have been encountered.
I would like to know WHICH non-existent column has been "specified".
How do I obtain this apparently obvious piece of ...
0
votes
1
answer
1k
views
Using insert and search cursors on same feature class to clone row?
I'm using the code below in order to attempt to clone a row in a feature class and add that same row to the same feature class after updating its metadata (Name, date_start, date_end, etc.)
The ...
0
votes
1
answer
2k
views
Updating records based on value in another field using arcpy.da.UpdateCursor?
I am trying to write file names and paths to two separate fields in a feature class, and the value for each record is dependent on finding a match in a list. When I run my code it writes the same ...
0
votes
2
answers
430
views
ArcPy: (SearchCursor/export to tiff ) with no output [closed]
I'm trying to write a script that uses a search cursor to loop through a field in a .shp file (Incident_Z) find every value that meets a specific condition (zip code=10004) and then at a scale of ...
0
votes
1
answer
42
views
Unable to add a row field by field in ArcGIS Pro table using Python script [closed]
I have written a Python script that creates a table with at most one row. The user is prompted to input values for each field, and the table should be updated accordingly. However, while the code is ...
0
votes
1
answer
894
views
Use arcpy.da.UpdateCursor in ArcGIS Pro to update a field with a NULL value
I would like to search a specific field within an attribute table in ArcGIS Pro using ArcPy and find all the null values and change the null value to the value above it. For example:
ID | field1 | ...
0
votes
1
answer
132
views
ArcPy UpdateCursor for each row in a table using calculated values
I need to update the whole table with the new values in SI. However when I start a new cursor, the list of values seems to go away and I cannot update each row with its corresponding value.
How can I ...
0
votes
1
answer
257
views
When to Update Row within an Update Cursor that uses multiple if statements for different fields?
I have a model that requires a stupid number of conditional statements. The older version was utilizing feature layers, select by attributes, and Calculate fields many, many times. I rewrote it to ...
0
votes
1
answer
303
views
SearchCursor RuntimeError: Underlying DBMS error [ORA-00923: FROM keyword not found where expected]
I need load OBJECTID from remote DB but I'm still getting error:
RuntimeError: Underlying DBMS error [ORA-00923: FROM keyword not found where expected] [SDEDO.E_EL_TU][STATE_ID = 22362]
I don't know ...
0
votes
1
answer
68
views
i want to create a layer with two different value of a field [closed]
I want to create a layer with two different value of a field.
Suppose I have a layer named "Road Network". In that feature class i have a field in attribute table named "addi_rd"......
0
votes
1
answer
161
views
Accessing single value in field using ArcPy with ArcGIS Pro
I'm pretty new to Python scripting (especially in ArcGIS). I would like to access a single element from a field and modify it. I understand that I can do this with cursors by searching the field ...
0
votes
1
answer
44
views
SearchCursor stops after first iteration
I'm working on a script that takes a few feature classes, unions them together and then runs a series of geoprocesses on them and puts it into a single feature class. From that feature class I have a ...
0
votes
1
answer
2k
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 ...
0
votes
1
answer
649
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 ...
0
votes
2
answers
248
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 ...
0
votes
1
answer
86
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
1
answer
247
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
1
answer
86
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), (...
0
votes
2
answers
555
views
Adding current row in arcpy.SearchCursor to selection
I want to make a code that select all unique values of a field in a attribute table. However, while everything in the code apparently works, I don't know how to add the current row in the Search ...
0
votes
1
answer
45
views
Field not updating correctly by updatecursor() method
in my work, I have to find the features having duplicate values of field "ID" and leave just one identical value by updating blank values in rest of the features.
My code for an add-in is:
import ...
0
votes
1
answer
60
views
UpdateCursor not deleting Null row
I am trying to change a title based on a feature class named Subject. They are parcel addresses, and the StrUnit field is the unit number. The issue is, not all of the parcels are apartments, so when ...
0
votes
1
answer
155
views
UpdateCursor giving ValueError: need more than 1 value to unpack?
I am writing a script assigning the ADMINAREA value to the empty LOCALITY fields from TWB_Suburbs to TWB_Property layer. I am getting:
ValueError: need more than 1 value to unpack
Is anyone able ...
0
votes
1
answer
635
views
arcpy.da.SearchCursor storing data in a list with a query
I am currently working with a database that hold street names, x and y coordinates and many more fields. I would like, through a search cursor, to store the x,y coordinates in a separate list for ...
0
votes
1
answer
331
views
Generating different number of random points for features using iteration with tool parameter values in feature attribute table using ArcPy [closed]
I want to generate a certain number of random points in N number of zip codes. The number of points to be generated for each individual zip code is stored the attribute of the feature class of all ...
0
votes
1
answer
647
views
Calculating field with ArcPy cursor?
I am trying to calculate field with the formula. I tried arcpy.calculate field management but still having difficulty.
(10/10.4*(100*(math.exp(0.000871* !A!)-1+math.exp(0.000537*
!B! )-1+math.exp(0....
0
votes
1
answer
2k
views
Using UpdateCursor based on current selection of features
What I want to do is to manually select two features with the mouse (e.g. point or polygon), each in separate geodatabases to then copy the attributes values from one to the other (for only these two ...
0
votes
1
answer
101
views
Updating empty field with calculated data using ArcPy?
I have a current script that calculates how many wells are in each county. Now, how do I update (fill in) the COUNTIES shapefile attribute fields of 'Well_Count' and 'Density'
import arcpy
arcpy.env....
0
votes
1
answer
66
views
Batching field calculations and feature classes in feature dataset using ArcPy?
I'm working on writing a script that will calculate facility ID's for feature classes in a feature dataset. Is there a way to do this without making feature layers and doing select/field calculate ...
0
votes
1
answer
1k
views
Verifying if user input as value exists in column using ArcPy?
I am trying to verify whether a value inserted by a customer exists in the field.
import arcpy
import os
import sys
#Set the work space
arcpy.env.workspace = "Y:\Milad\GeometricNetworkAnalysis"
path=...
0
votes
2
answers
448
views
Passing conditional statements into arcpy.da.UpdateCursor
How do you pass conditional statements from a list into a data access module update cursor?
I am using ArcGIS v10.3.1.
a = r"...\Default.gdb\New_Shapefile"
ConList = ["r[1] >= 1"]
with arcpy.da....
0
votes
3
answers
855
views
Converting arcpy.da script to arcpy.SearchCursor? [closed]
I am trying to learn python for ArcGIS.
Currently on this tutorial exercise:
https://www.e-education.psu.edu/geog485/node/191
import arcpy
featureClass = r"C:\Users\A\Desktop\ARC\USA.gdb\...
0
votes
1
answer
512
views
Using LIKE clause in update cursor gives syntax error?
I am trying to write a second update cursor within one script. This requires a LIKE condition to look up a value within the same layer to identify rows to update the field within that layer (first ...
0
votes
2
answers
159
views
Updating z values from joined table using ArcPy?
I have joined two tables. The first table includes the current z values, while the new table includes new z values. I first tried to snap, but this didn't update the Z values, only X and Y. How can I ...
0
votes
1
answer
215
views
Calculate the area in sqkm across UTM zones using arcpy cursors
I am trying to update the area field in sqkm of my table using Search and Update cursor from the arcpy library. The area needs to be updated using the different utm zone. I intersected my shp (that I ...
0
votes
1
answer
386
views
Finding matching rows across columns and populating a separate column
I am trying to write a script that recategorizes 70 attributes in to 1 of 5 attributes.
I have two tables, each with two columns that I am focusing on. The first table has one column with 20k rows ...
0
votes
1
answer
104
views
Update cursor with not populating table with describe/xml metadata
I am writing a script that will export feature class metadata to a GDB table. The metadata is first obtained through arcpy.Describe and by parsing an exported XML file. The script then creates a GDB ...
0
votes
1
answer
160
views
Setting variable to search cursors to calculate percent using ArcPy?
I made a Python script tool and to finish my script I want to perform a percentage calculation using the 2 results from my search cursors. And the print the result to screen.
Here's what I have (but ...
0
votes
2
answers
214
views
How to insert a single point feature into a shapefile?
I have the following problem. I am doing an analysis which creates a shapefile "A" with one or more point features. In the next step I need to insert the individual point features of the shapefile "A" ...
0
votes
1
answer
402
views
cannot delete row from coverage with updatecursor
I am able to update without any issue or error but when I try to delete a row I'm getting an error, see below for the code and error
I can't see why it would fail.
import arcpy
def count_row(data):
...
0
votes
1
answer
571
views
Update Cursor to Polyline Creates Records with Missing Geometry
I am working on an arcpy script to create a polyline feature class with a single polyline feature between each 2 points in a sequence of points. I use a search cursor to first create a table with all ...
0
votes
1
answer
2k
views
Append count of unique values to dictionary keys and then sum the occurrences
I am trying to compare the occurrences of codes from a column within feature classes against a list from a spreadsheet column and then add these to a dictionary where the feature class name is the key ...
0
votes
1
answer
362
views
Using arcpy.SearchCursor() for multivalue field?
I need to make a multivalue field to be selected as:
Input_Features = arcpy.GetParameterAsText (0)
Num_Pop = arcpy.GetParameterAsText (1) #(It contains population data for the periods 2020, 2025, ...
0
votes
1
answer
1k
views
Python Script to update all feature classes/datasets in gdb with search and update cursor?
I have two geodatabases, one is a production sde database, the other is a backup in a local file geodatabase. The script runs as a task once a month and is very resource intensive. I am using ArcGIS ...
0
votes
1
answer
2k
views
Arcpy: Geometry object - distanceTo method in a for loop
I'm new to Python so sorry for this maybe trivial question.
I have 4 lines and 4 points, which belong together. I want to get the closest distance from point 4 to line 4, point 3 to line 3, ... . I ...
0
votes
1
answer
73
views
Update multi fields in multi shape files with arcpy
I have 3 shapefiles belongs to one state "District", "Mandal", "Village".
These three shapefiles have the same fields like DName, MName, VName.
I want to update all field in all shapefiles at a ...
0
votes
2
answers
83
views
SyntaxError with cursor and Feature Selection in ArcPy?
I tried to select each feature in the layer "temp" and use the selected feature to select features in the other layer "Railway" based on location and then do some calculations with the "Railway" layer ...
0
votes
1
answer
639
views
Extracting from attribute tables by arcpy
I'm having some trouble connecting ideas on how to solve a problem. What I have is a shapefile from which I have to extract from one field, which contains 3 types of attributes (BS, RS, BRN). For each ...