All Questions
Tagged with insertcursor or cursor
1,050 questions
0
votes
1
answer
41
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
31
views
Using ArcPy to insert polygons
I am trying to insert three polygon into a shapefile. The goal is to use a function that will create the polygon. That way, I can pass the coordinates of the polygon into the function. I have read ...
0
votes
1
answer
42
views
Adding multiple fields to feature class
I have created a simple arcpy script to add four fields (name, shapeArea, shapeLen, quantile, in that order) to a layer and to compute the values of shapeArea and shapeLen. Because I need to do this ...
1
vote
1
answer
35
views
ArcPy Update Cursor Output Order
I have a workflow that ingests a feature class, loops through with an update cursor, and then appends to an SDE table. The output feature order does not match the input order. I suspect parallel ...
1
vote
1
answer
66
views
Duplicating records by using column delimiter in ArcGIS Pro
In ArcGIS Pro 3.3, I have a shapefile where I need to create duplicate records (while preserving geometry per duplicated record) based on the values in a column. The table is structured similar to ...
0
votes
1
answer
45
views
Using search cursor or select for related table data in ArcPy
I am very new to ArcPy and code.
I have about 600 zones that overlay ~8000 different census blocks, which have been divided so that census blocks that aren't fully inside a zone are split, meaning ...
1
vote
1
answer
67
views
Calculating search cursor/percentage using ArcPy
I work with zoning info and have a series of census blocks that are overlapped by a larger zone. I used the identity tool to split the census blocks so that where they overlap they are separated, ...
1
vote
2
answers
69
views
Keeping curves intact while modifying geometry in an UpdateCursor
I am trying to modify some lines in ArcGIS Pro, shifting the Start vertex to coordinates in a pair of fields in the layer attributes. My arcpy script works... almost.
import arcpy
aprx = arcpy.mp....
0
votes
2
answers
69
views
arcpy - Select by Location in an Update Cursor
I have parcels and a buffer around greenways. I'm trying to populate a field in the parcel fc with a '1' if the parcel intersects the buffer. I can get that fine with an update cursor and select ...
1
vote
0
answers
32
views
Nested cursors with arcy.da.SearchRelatedRecords
I am trying to use python (arcpy) to filter through some data in my Ancestry-GIS.
All inside the same geodatabase I have:
A point feature class called
places
shape | placename | GlobalID |
Two non-...
2
votes
0
answers
92
views
QGIS is not properly closing some PostgreSQL binary cursor, letting DB transactions with a state "idle in transaction"
In a QGIS 3.34.5-Prizren project having PostgreSQL/PostGIS layers, I can sometimes see such queries for different layers in the "Debugging/Development Tools" tab, under the "Query ...
1
vote
0
answers
62
views
How to update the Z value using an UpdateCursor
I'm trying to update the Z value using UpdateCursor, the problem is the update is not working.
import arcpy
from collections import defaultdict
import random
from statistics import StatisticsError, ...
0
votes
0
answers
66
views
My while loop in ArcMap using ArcPy is not giving what I want
I have revised my code I am trying to get cumulative catchments from a table in arcmap using a table, I am using four fields namely CatName(cid), Area(Load) and DS(Downstream Node) , I want the ...
0
votes
2
answers
70
views
Selecting records after using insert cursor
Using ArcPy and on the same script, I would like to perform a SelectLayerByAttribute tool to select the features created with the InsertCursor tool.
coords = [1, 2, 3, 4]
pointlyr = 'point'
Sr = ...
0
votes
1
answer
45
views
Search cursor skipping every other row
I am trying accomplish something which should be fairly straight forward. I am trying to merge snowfall events within 4 hours into a single event so. The end of the entire event, and the name of the ...
1
vote
1
answer
93
views
for loop with a cursor only iterating once [closed]
I am running a search cursor with the code below (part of it) and my code is only yielding the first iteration. There isn't any selection on the FC prior.
Why is it stopping at the first iteration?
...
1
vote
1
answer
46
views
Select points by polygon and update attribute field
For each record in the pointLayer, I'm trying to see where they are located using the polygonLayer. Then, update this location information to the "SWPsubwatersheds" field from the pointLayer ...
0
votes
1
answer
193
views
Calculating SUM of multiple fields into new field using ArcPy
I have 4 fields (STREAMS, SLOPE_ASPECT, FIRES, TREES) that are assigned either a 1 or a 0 based on whether they exist or not.
The goal: Create a new field "ranking" the best locations (...
0
votes
1
answer
50
views
arcpy.da.UpdateCursor() on field values in rows that meet "where_clause"
I'm looking to copy the values from the "Layer" field to the "COMMENTS" field... then change the string value in the "Layer" field to "Fiber Cable". The feature ...
0
votes
2
answers
85
views
Only want to updated first 26 records in a table using UpdateCursor
I'm trying to updated values for records in an attribute table. All records have a quadrant number (in field "Quadrant") and a random integer (in field "RandomSeg") assigned to ...
0
votes
0
answers
59
views
Update field using dictionary and list
I have two layers, layer A and layer B. I need to update the SC field on layerA from layerB SC_1 field. I have the following that does a spatial join, then use a Distinct list to populate the SC_1 ...
0
votes
0
answers
125
views
Getting assettype and assetgroup field values from feature class with domain using ArcPy
I am trying to get the field values of assettype and assetgroup from a feature class but I am not able to get the values there are subtypes assigned to those fields and also values are domain coded ...
1
vote
1
answer
90
views
Python-code "max value among fields and print field name" working in ArcGIS Pro command line, not in script-tool
I tried this code in ArcGIS Pro.
I am getting the code to work great in command line. However, trying to script a tool out it in ArcGIS Pro.
Getting an error:
File "", line 13, in ...
1
vote
1
answer
288
views
TypeError: cannot update branch versioned table
I have several editors making edits to a branch versioned, sde referenced layer on ArcGIS Portal. As part of the work flow, I want editors to open their ArcGIS Project saved with their edit version of ...
0
votes
0
answers
204
views
How use multiprocessing with function arcpy.da.InsertCursor
I'm working with a table in the database that has more than 1 million records and a total load of this table takes about 8 hours because it has geographic data, the table is a featureclass. Basically, ...
2
votes
1
answer
108
views
How can I loop through features in layers to create an individual geodesic viewshed raster for each feature?
What I have:
1/3 Arc Second DEM for the extent of my AOI
Feature class containing ~16 observers with fields for 'observer_offset,' 'outer_radius,' 'horizontal start angle,' and 'horizontal end angle'
...
0
votes
1
answer
74
views
arcpy.SearchCursor and unexpected results
I'm stuck on results that arcpy.SearchCursor is outputting. I'm accessing a table on a database connection. When I run this, it crashes with an error:
argument of type 'Row' is not iterable
I ended up ...
2
votes
1
answer
79
views
Shapefile not Z-enabled although the environment is Z-enabled in ArcPy
My attempt is to view raster values in the command window. The follwing code is thought to do this by converting the raster to a point feature file and by successively scanning the values at the ...
2
votes
2
answers
110
views
Update specific row based on string
I'm new to ArcPy. I am attempting to find the string 'Unknown' and update the 'Comments' field, that indicates which field contains the 'Unknown' string for that row. I was attempting to use ...
1
vote
1
answer
43
views
Calculating individual Sum of multiple fields
I am trying to calculate the sum in each field in my list:
Cost_Adders = ["RR_CROSSING", "INTERSTATE", "RIVER"]
for Cost in Cost_Adders:
where = f"Cost_Adders = {...
2
votes
1
answer
104
views
Changing value of layer attribute based on geometrical conditions of line elements through ArcPy in ArcGIS Pro
I have a feature class layer that comprise of line elements. For my purpose, I needed the start and end point coordinates of each line, so I added new columns with add field and use calculate geometry ...
1
vote
0
answers
28
views
Calculate distanceTo between points consecutively and use an update cursor to fill in a new field in an attribute tablea
I have a shapefile that I need to update with the distance between its points in the order they appear in the attribute table. I've been instructed to do this by using an Update Cursor and the ...
0
votes
1
answer
41
views
How to extract field values from one layer, add them together, and insert them into a field in a nearby layer? [closed]
I'm working with two different point layers (layer1 and layer2). Layer1 will have a field (field1) that contains four possible values (a, b, c, d) and another field (field2) that contains a given ...
0
votes
1
answer
139
views
Find duplicates and merge attributes arcpy
I have a point shapefile which has duplicate points based on an "ID".
ID1 + permit1 + resources associated to permit
ID1 + permit2 + resources associated to permit
ID2 + permit1 + resources ...
1
vote
0
answers
120
views
arcpy.da.SearchCursor is skipping rows when selection is "large" [closed]
In ArcMap 10.6.1 I have a script Python (2.7.14) in a simple ArcToolbox that uses an arcpy.da.SearchCursor to iterate through the selected point features (poles) to produce an Excel report. The cursor ...
1
vote
0
answers
76
views
Flip line only on selected rows with arcpy.da.UpdateCursor and calculate new line bearing on it
I'm trying to use arcpy.da.UpdateCursor to flip line only on selected records in shapefile that are greater than value 180. Then I would like to recalculate Line Bearing on the attribute called "...
1
vote
1
answer
99
views
Flipping line that touches certain points using ArcPy
I have a layer of points and a layer of lines (shapefiles), that have been split so the lines have 2 vertices.
I would require to change the direction of those lines (flip), only if they touch (...
0
votes
1
answer
166
views
Using Search/Update cursors to find the max value in a field and replace negative numbers in same field with max value + 1
I am a bit rusty with Python, I know conceptually what I need to do but am not sure of the syntax/formatting.
The table I'm working with has an id field with negative and positive values and null ...
0
votes
1
answer
102
views
Using Python dictionary to update street type in another field in ArcGIS Pro
I am using a dictionary to update street type in another field in ArcGIS Pro 3.0.3
I am a novice python user and I am having problems updating a string field with a dictionary.
I am joining ...
0
votes
1
answer
890
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
0
answers
175
views
Edit attribute tables with another table in ArcGIS Pro using ArcPy
I have two tables and I need to update one based on the other. For this, I need to take two columns (idscap and spardcode) as the initial reference value and thus modify all the columns of the table.
...
0
votes
1
answer
78
views
ArcPy SearchCursor : AddMessage with field value
I'm trying to get a message in ArcMap dialox box showing the features IDs that have null value in attributes X, Y, or Z.
myFeatureClass
ID_FIELD
X
Y
Z
101
140160
350350
450
102
140165
350348
103
...
2
votes
1
answer
136
views
Adding geometry to a db table using ArcPy from an existing points dataset
I am attempting to write an ArcPy script to add the geometries of a points data set to records in a db table. Each record in the db table has a field containing a date, and an associated numeric value ...
0
votes
2
answers
900
views
Update cursor not working but with no errors [closed]
I want my code to find the maximum value of a field from attribute table and return that as a the value for another field in another attribute table, trying to do this with search cursors and update ...
0
votes
1
answer
159
views
Updating 3 million rows in file geodatabase
I have a GDB which has 3 million annotation data, then I would like to modify some filed values based on csv table
I'm using the following ArcPy scripts now, but it's too slow
import arcpy
import ...
1
vote
1
answer
162
views
Creating shapefile from text file using ArcPy
Fourth update, per suggestions from comments and professor. Still getting the "takes no arguments" error "Traceback (most recent call last):
File "C:\Pythonpro\pythonProject2\...
0
votes
1
answer
71
views
Looking for PyQGIS equivalent of ArcPy "SearchCursor" class [closed]
How can I consult and use shapefile attributes without reflections on the map? Like a 'Search Cursor object' from ArcObjects. Also using a query expression to filter data.
0
votes
2
answers
176
views
Inserting geometry objects into existing layers with ArcPy
I'm trying to add new features to a layer based on geometries created from a list of WKTs. The code I have so far:
Creates a polygon layer and sets the projection (NAD83)
Creates a geometry object (...
0
votes
0
answers
23
views
how to compare all the fields of two feature class with 0 in one file and null value in another file and change it to the same value as of first file
need to search the inputpolygon and checkpolygon and update the value to check polygon
with arcpy.da.SearchCursor(Inputpolygon,['market', 'type', 'latitude','postalCode'])as Cursorop:
with arcpy.da....
2
votes
1
answer
288
views
Copy geometry only from one feature class to another based on condition
I'm trying to use ArcPy to copy only the geometry from one feature class to another based on a certain condition. Here is my code so far:
source_fields = ['contition_field', 'SHAPE@']
icursor = arcpy....