Questions tagged [cursor]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
13 views

Accessing multiple fields from a dictionary

I am trying to populate three new fields with data from another three corresponding fields. Is there a way to access two fields at the same time from a dictionary to use in the analysis? I am very new ...
user avatar
  • 23
0 votes
1 answer
30 views

ArcPy error handling not picking up index error in script tool

I am creating a script tool and I am trying to handle a unique error message that is created when a csv file is not formatted correctly for the script. When I use the script standalone, the error is ...
user avatar
0 votes
1 answer
26 views

Converting extent to int is changing value [closed]

I am iterating to get extents (XMin, XMax, YMin, YMax) of each feature (1 deg x 1 deg polygons). The values of the extents parameters are double precision and display to one decimal place. I need to ...
user avatar
  • 53
0 votes
1 answer
28 views

Iterate through fishnet polygons for extents and update field

I am new to Python. I'm creating a Script Tool in 10.8.2 that generates polygons from Create Fishnet of 1 deg x 1 deg and a new field GEOCELL. I need to update field GEOCELL with the lower left corner ...
user avatar
  • 53
0 votes
1 answer
43 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 ...
user avatar
2 votes
1 answer
29 views

List Feature Classes and use Update Cursor to calculate date values

The basic premise is as follows: look in a folder and find all feature classes (within file GDBs), use a for loop to isolate feature classes one at a time and subsequently isolate date attributes, ...
user avatar
  • 71
5 votes
2 answers
151 views

Python error in Update Cursor for ArcGIS: " 'int' object has no attribute 'type' "

I am fairly new to python and am trying to make a script that looks through an ArcGIS feature class and updates <null> values to 'tbd' or 99999 based on the field type (string, double/integer). ...
user avatar
  • 71
-1 votes
1 answer
40 views

UpdateCursor increment reference in initial layer with ArcPy dosen't work [duplicate]

I use a function to increment the reference according to a condition I would like to update the reference in the initial table I do it with the following code but the line for the update doesn't seem ...
user avatar
2 votes
0 answers
42 views

Compare two fields in different feature classes using ArcPy

I am trying to make an automation script to evaluate the distance and compare attributes between an incoming layer and another existing layer in the database. I made this script to say: If the ...
user avatar
0 votes
2 answers
41 views

Select By Location and Calculate the Field Attributes Using ModelBuilder in ArcGIS Pro

I want to create a ModelBuilder tool that I can use to save my time when I need to populate a ward name into my asset layers. Here Ward is a Polygon feature layer and my asset layers can be point, ...
user avatar
0 votes
0 answers
25 views

Why points created from polyline are not being placed on original polyline? [duplicate]

I have extracted coordinates of a polyline and created a list using FeatureClassToNumPyArray. Now i have written code to create points at those vertices. I have used the SR information of the polyline ...
user avatar
0 votes
2 answers
74 views

Iterating over (selected) features by the same id

I have a feature class Test_NearestNeighbor_Code. This feature class has 7373 polygon features and a column/ field called osm_id. I want to do a calculation with all features that have the same osm_id....
user avatar
  • 3
1 vote
0 answers
52 views

Geometry of the feature getting deleted after UpdateCursor

I am making a script which calculates numerous indices for each building. Here I am trying to get the area a 100 buffer around the building and the area of buildings intersecting with the buffer. Now ...
user avatar
2 votes
2 answers
85 views

Refer to field name instead of index position in ArcPy cursor

With ArcPy cursors, we can refer to fields by using the field index position: with arcpy.da.SearchCursor(feature_class, ["ASSET_ID","ROAD_ID","CLASS","OWNER",&...
user avatar
  • 716
0 votes
1 answer
80 views

ArcPy SearchCursor Error: "An expected Field was not found or could not be retrieved properly"

Using ArcPy, I'm trying to use a search cursor on a point feature class to populate a list. import os, arcpy # make feature layer in memory lyr_acq = "lyr_acq" arcpy.env.workspace = ...
user avatar
0 votes
1 answer
23 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 ...
user avatar
1 vote
2 answers
48 views

Finding max value in field using ArcPy

I have a table and I want to find max and min value in specified field (f1) with their names. I used this code but I only could print max and min values in f1. How can I print their names Like the ...
user avatar
1 vote
1 answer
23 views

QGIS 3.16 cursor jumps out of screen when reshaping features

when I'm reshaping features my cursor sometimes jumps out of screen (see gif). This error occurs only when clicking on certain vertices but I can't find any pattern. When I save and restart QGIS it ...
user avatar
  • 31
0 votes
0 answers
35 views

Iterating through shapefile and appending each row separately to existing shapefile

I am attempting to iterate through each row of a shapefile, run a process on it (finding the nearest point from each in_feature to the closest near_feature) and then appending each row to the ...
user avatar
1 vote
3 answers
68 views

Updating first occurence of duplicate with lowest value in given field using ArcPy cursor

I have a few hundred GPS data points (saved in an ArcGIS Pro 2.9 file geodatabase) that logged simultaneously with different speeds. I am looking to write a Python script that will compare each row's ...
user avatar
  • 123
1 vote
1 answer
63 views

Creating a buffer for each row in a shapefile

My input is a point shapefile with more than 500 features. I need to create separate shapefiles with a buffer of 15 kilometers around each feature (so the output will be more than 500 shapefiles with ...
user avatar
0 votes
1 answer
39 views

All rows are being overwritten with last features value using arcpy.da.UpdateCursor

I am trying to populate fields based on objects. When trying to use Update Cursor it overwrites all of the row values with information from the last feature read. I am sure that I am meant to get it ...
user avatar
2 votes
2 answers
114 views

Sorting field values within column in table using ArcPy

I have a feature class table named fcwells. It has a bunch of different columns but the column I need sorted is 0Meters. Many fields under 0Meters have multiple values separated by commas and it is ...
user avatar
0 votes
1 answer
42 views

Inserting new point from XY Coordinates with field values using ArcPy

I am trying to add new point from table using XY coordinates fields to database. I can add point without fields, but when i try to add point with field values i can not do it. In SearchCursor ID is a ...
user avatar
0 votes
1 answer
49 views

Updating cursor with values from txt file

I'm trying to update fields with updateCursor, but it doesn't work at all. I've worked with updateCursor before many times but this time - no success. I have a feature class (frameBoundaryBeforeAT) in ...
user avatar
0 votes
1 answer
38 views

Replacing zero with no data in CSV file using ArcPy cursor

I have a CSV file with zero as some of the attribute values. Trying to use cursors and replace all zeros with no data or blank values. I am able to replace any numbers. But not able to update with ...
user avatar
  • 1
1 vote
4 answers
107 views

ArcPy remove rows which don't match a list of substrings

I'm trying to use ArcPy to remove results of an OD cost matrix which don't have specific street names. I have the street names stored in a list and the OD results in a field called "Name" as ...
user avatar
1 vote
1 answer
30 views

How to avoid default_value in field with ArcPy cursor (e.g. row[i]=None)

Some field in field_list has default_value=1 After executing the following code, such field is filled with the value «1», but normal fields are filled «Null». How could I avoid this for the field (...
user avatar
0 votes
0 answers
41 views

Resetting ArcPy 'for' loop when using SearchCursor on shapefile

I am comparing the data in two shapefile Ex: Existing.Shp and UpdatedRecently.shp. Existing.shp files has 3110 Records and Updated.shp has 410 records total and 110 duplicated records from Existing....
user avatar
0 votes
0 answers
69 views

Using ArcPy cursor to insert polyline

I'm trying to use an InsertCursor to write code where I insert a line segment from two points in the shapefile, but I keep getting a type error explained below import arcpy, os, traceback fc = 'C:/...
user avatar
  • 69
1 vote
1 answer
48 views

Writing cursor to delete objects greater or less than particular FID

I have a couple of shapefile attribute tables I want to delete items greater than 10 FID using a cursor. My user arguments are the file path, FID, and the number that is the minimum number not to ...
user avatar
  • 69
2 votes
3 answers
114 views

ArcPy Update a fields value as long as another field value stays the same

Problem: Using ArcPy in ArcGIS Pro 2.5.2. I want to increase a fields value by 1 as long as the value in another fields stays the same. In the picture below I show what I mean (filled in manually). I ...
user avatar
  • 1,056
1 vote
1 answer
75 views

IndexError: list index out of range when using UpdateCursor

I am trying to update all values in column in a feature layer in ArcGIS Pro using arcpy.da.UpdateCursor, but I am getting the error: IndexError: list index out of range I am trying to update all ...
user avatar
  • 23
3 votes
2 answers
147 views

Calling specific row using ArcPy search/update cursors

When working with search and update cursors, how do I call upon a specific row? In this example: import arcpy, os # I want to find a row where the FID is 10 # print value field in the row where FID ...
user avatar
  • 69
0 votes
0 answers
135 views

Using ArcPy SearchCursor and InsertCursor to Search, Copy and Insert Rows in Same Table

I'm new to ArcPy and really coding in general. I have three fields titled "Subcat_1", "Subcat_2", and "Subcat_3" all being used to categorize different themes of survey ...
user avatar
  • 1
0 votes
0 answers
65 views

InsertCursor throwing "error return without exception set"

I'm trying write data to an Enterprise geodatabase but it still throws error return without exception set (for clarification - error throws row cursor.insertRow(data). I have method: def ...
user avatar
0 votes
1 answer
76 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 ...
user avatar
0 votes
1 answer
42 views

UpdateCursor gives RuntimeError that column does not exist

I have managed to get my previous update cursor to work without any hiccups. All I have done is change the fields the script needs to look for. The error I am getting is: RuntimeError: A column was ...
user avatar
1 vote
0 answers
78 views

Updating a big table using UpdateRow cursor and grouping by values from a cell

I'm working with a big table in ArcGIS Pro, with data based on cells and date, to estimate population values at the end of different days. For that, I use official population data on the first day, ...
user avatar
0 votes
1 answer
78 views

Update cursor with nested dictionary with ArcPy

I'm trying to update a mosaic dataset tables attributes with values from a CSV. The CSV and dataset share a field that uniquely identifies each record, and all of the fields to update have exactly the ...
user avatar
  • 363
0 votes
1 answer
50 views

SearchCursor from source TEXT field set as <Null> being interpreted as ' ' (writing to DOUBLE)

I am Curious about the behaviour of the SearchCursor on a server Database feature class. the data for some of the the fields I want to read is set as TEXT, with some of those fields values set as <...
user avatar
1 vote
0 answers
41 views

An Invalid SQL statement was used with SearchCursor

The code: import arcpy fc = r'C:\Users\xxxx\OneDrive - xxxx\Documents\ArcGIS\Projects\xxxx_Test\FinalUnions_VTDs.gdb\New_Final_VTD_SplitLayer' prevFieldValueList = [] counter = 1 with arcpy.da....
user avatar
6 votes
2 answers
233 views

Finding common Intersection area of each pair of rectangles with circle buffers inside each one using ArcPy with ArcGIS Pro

I'm in ArcGIS Pro environment and for this case a simple Intersect tool is not enough, so I'm trying some Python scripting. Below is the rectangles and the circle buffers that I need their pair ...
user avatar
1 vote
1 answer
83 views

Python Code Runtime Error: In transaction mode using ArcGIS Pro

arcpy.env.workspace = "Project Path" feature1 = arcpy.env.workspace+'TableWithEstimates' feature2 = arcpy.env.workspace+'TableToJoin' interval = 7 arcpy.CreateTable_management(arcpy.env....
user avatar
  • 13
0 votes
1 answer
37 views

SearchCursor inside other SearchCursor

I have two layers. The first is bicycle stations, the second is bicycle rentals on a specific day. I want to make a selection by station number attribute using the station list contained in the first ...
user avatar
  • 9
0 votes
1 answer
62 views

Search Cursor in ArcPy for a range [closed]

I'm getting an error while using the where_clause for a length which has a "float" datatype. While other variables in a function are working fine, even on ArcMap "length" part is ...
user avatar
4 votes
1 answer
89 views

Update Cursor - Removing Strings/keywords

I have a mosaic data (over 500k rows) I want to run a UpdateCursor on to clean up a string field which roughly follows this pattern: 1432 Arequipa 92 PRINCIPAL SAT CAPTURE 2235 Pokhara 11 SECONDARY ...
user avatar
  • 363
0 votes
1 answer
41 views

Update point fields with fields in intersecting polygon

I get new points (inspections) every day. Each point falls within a polygon (district). I need to update 3 fields (Week, RecycleRt, RecyCollDay) in the point feature class with the district fields. I ...
user avatar
-2 votes
1 answer
86 views

SQL statement (where_clause) does not work for UpdateCursor syntax but same works for SearchCursor syntax

feature class fc1 (daily data) and feature class fc2 (geodatabase) both have unique_id field which will be used to map Col1 rows in fc1 to update corresponding Col2 rows (not all rows) in fc2. Below ...
user avatar
0 votes
0 answers
70 views

ArcGIS/ArcPy gets XY backwards?

Okay, this has been bugging me for a long time, but I've always been too embarrassed to ask given how basic a question it is. Do the data access cursors get XY backwards when you use tokens like SHAPE@...
user avatar

1
2 3 4 5
20