Questions tagged [cursor]

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

44 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
107 views

UpdateCursor doesn't give error until the next iteration ('NoneType' object is not iterable)

I have a string field within a GDB that does not accept all string values, giving a "The row contains a bad value" error. I have fixed the issue with InsertCursor (prompts user for new value), but can'...
2
votes
0answers
222 views

Using update cursor to update feature class field from another table with incremental date/time query?

I have a feature class called AO15_16 where the field id needs to be updated. The update will contain a unique id based on a query of another table where I am querying issueddate, issuedtime and `...
2
votes
0answers
73 views

Import csv value to an empty field in a point feature class

I have a .csv with three colums and a point feature class with an empty field that i would like to fill with a value of the csv. In the .csv i have 15 rows with a code. In the feature class just one ...
2
votes
0answers
68 views

Multiple Cursors

Below is the sql statement which I have explained below. Declare Cursor c1 is select store_number ,0 as total_area,0 as BG_ID ,0 as store_geom from table1 where CLIENT_ID= 1 and ORG_ID ...
2
votes
0answers
34 views

Q: cursor memory and fields therein

Theoretical Python question. Say you have an update cursor while-loop for a few selected records. While looping through the rows, at some point a nested if statement triggers an "addfield" event. The ...
2
votes
0answers
345 views

Can I use a cursor to select two rows and compare attributes

Can I use the cursor search function to look at the first two rows in a table and select them so I can compare attributes and possibly merge them or change attributes? I am using ArcGIS 10.0
2
votes
0answers
348 views

Processing arcobjects cursor is taking long time

I am maintaining a code on arcobjects 10.1, and there is a bug happening. I have a code that is parsing through a cursor, and generate a where clause statement to run it on a second query. So the code ...
1
vote
0answers
62 views

Accessing additional CAD annotation fields

I'm trying to read certain values from the annotation layer of a CAD file (MicroStation.dgn). It seems like for certain entities (Cell) the text isn't stored in the field 'TxtMemo' or 'Text'. When I ...
1
vote
1answer
79 views

Getting for loop which stops after first one to iterate properly?

I originally asked UpdateCursor can't acquire lock, but can acquire lock in TestSchemaLock and got some help about why my code wasn't acquiring a lock. My new problem is that my code isn't fully ...
1
vote
0answers
187 views

Arcpy InsertCursor inserting geometry into Shape field

I'm trying to write a script that reads geometry for each row in feature class, then create a new feature class and insert into it that geometry. It has to work with ArcGIS 10.0 so I have to use arcpy....
1
vote
0answers
129 views

Looping through data to perform one to many join in ArcPy?

I want to join the attribute tables of two feature classes in ArcGIS and populate the fields from one table to another. This is a one to many join and there are duplicate rows of data in the join ...
1
vote
0answers
113 views

Iterating through a Feature Class

I am using ArcGIS Desktop 10.4. I am trying to iterate a process through a Feature Class to calculate individual (and unique) values in a particular field. I can calculate the field just fine, but ...
1
vote
0answers
167 views

Update multiple rows in a cursor - Arcpy

I will try explain my code in a simpler way, because it is Portuguese. I've been trying do make a Python Toolbox in order to select "sectors" of lines separated for some kind of points. For example, ...
1
vote
0answers
182 views

IFeatureCursor returning null features

I have created an IFeatureCursor using IFeatureClass.Search(). The features in this exist and are not null. However, when I pass that same cursor into another method there are suddenly no features. ...
1
vote
0answers
42 views

How can I insert a record N amount of times using cursors?

I need to generate a polygon FC using some records previously flagged as 'NUMBER_GT_NUMBER_END = 1' These records need to be loaded into a new schema of the same FC in order to include duplicates ...
1
vote
0answers
48 views

Point feature class showing up empty?

After days of solving errors and various issues I finally have code that runs in ArcMap... but the shapefile that shows up does not show any points on the map. I checked the attribute table and all ...
1
vote
0answers
39 views

Not able to apply update cursor on OS MasterMap feature classes created using OS Translator II

I am using OS Translator tool to convert OSMasterMap GZ files to PostgreSQL database. The feature classes created are query layers and cannot be edited in ArcGIS. Now I am writing a code to add new ...
1
vote
0answers
566 views

Cursor help on large spatial query in PostgreSQL

I have two very large tables on which I want to perform a spatial query. UPDATE table_a SET att_1 = b.att_1, att_2 = b.att_2 FROM table_a AS a JOIN table_b AS b ON ...
1
vote
0answers
55 views

Trying to delete specific features within feature class

I am working with arcmap 10.2. I have a database that has a few feature classes in it. Within these feature classes, they have a field labeled as Height. Height is a string field that houses numbers (...
1
vote
0answers
85 views

Finding duplicates of same point in feature class and only keep maximum of field using ArcPy?

I have a feature class with fields: Latitude, Longitude, Type, Magnitude, City, State, Comment. If Latitude, Longitude , and Type are the same, I only want to keep the record with the highest ...
1
vote
0answers
761 views

Runtime Error: Cannot Open Feature Class in Editor Session

I am using an update cursor in a script and need to make edits from arcpy.da.Editor. The error that is being thrown is a Runtime Error where the feature class cannot be opened. import arcpy import ...
1
vote
1answer
114 views

Updating Cursor to Include Newly Created Features?

I am using ArcMap 10.1 and python to create cursor that starts at the one and only row of a polyline shapefile, some code runs to create a new feature based on the position of the exisiting feature, ...
0
votes
1answer
87 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
0answers
41 views

Using UpdateCursor in the same loop as SearchCursor

I have 2 layers, one with land plots and one with hazard zones. I want to iterate through the layer with land plots and for every plot I want to add 2 (or 3, depending on some variables) fields. Then ...
0
votes
1answer
57 views

Grouping wildfires dates by season and getting sum and count using ArcPy?

I am having some trouble creating a new shapefile and CSV to group wildfires into seasons. What I want to do is to group the wildfires by meteorological season (summer, fall, winter and spring) for ...
0
votes
0answers
23 views

RuntimeError: Objects in this class cannot be updated outside an edit session

I recieved this error: RuntimeError: Objects in this class cannot be updated outside an edit session while runnng this code: # import modules import arcpy import random from arcpy import env ...
0
votes
1answer
46 views

How can I insert degree symbol to attribute table in feature class?

I am trying to insert a bearing string into an attribute table, I want the string to look like this -> S 58°15'31" W , but what I am getting in the table is this -> S 58°15'31" W The code I am ...
0
votes
0answers
15 views

Getting Error for Search Cursor in Arcpy module

I am trying to use Search Cursor on Data. Following code is running for Numeric field without any error. cursor=arcpy.da.SearchCursor("Wells","*",""""Depth"=30""") for i in cursor: print i[1] ...
0
votes
0answers
37 views

Python Code to return column data in multiple feature classes and gdb's

>>> import arcpy ... in_table = r"K:/MAPPING/PA/LEIDY/REPL/0188_18/MDL/GIS/MASTER/0188_18.gdb/DP_Centerline" ... with arcpy.da.SearchCursor(in_table, ["last_edited_date"]) as scursor: ... ...
0
votes
0answers
30 views

Compare Specific Points of Line Features in two Feature Classes using FeatureClassToNumPyArray

I am looking to compare the first and last point between features in two different feature classes. The features share a common ID. My thought was to create two arrays via FeatureClassToNumPyArray. ...
0
votes
0answers
17 views

Skip locked rows for editing using ArcObjects?

Can I lock a row so that the cursor does not bring it because it is in use by another cursor ? ITable table=GetTable(); ICursor crntCrsr=null; ICursor secondCrsr=null; crntCrsr=table.Search(filter,...
0
votes
0answers
29 views

Converting string 24hr date/time field values into new field with just 12hr time as string using ArcPy in ArcGIS Pro?

Without explaining all my reasoning for why we need to do this, I need to take a field that our GPS units create called "CreationDateandTime" and use the values in there to create a new "UID" field ...
0
votes
0answers
37 views

Write a script to create a new feature class and add the point objects of geometry to that feature class

The coordinates of the vertices representing the street Kochstraße in Erlangen are stored in a text file called Koord_Strasse.csv. Write a script to create a new feature class and add the point ...
0
votes
1answer
36 views

Using arcpy.da.SearchCursor to obtain values from field that correlates with “year” field?

I am very new to coding. I am attempting to use SearchCursor to go through the attribute table of a feature class and return a list of unique years from the years field (which I have done). I am ...
0
votes
0answers
39 views

Updating Polygon only on multiple selection, not single, using ArcPy?

I have a script that selects all addresses within a polygon (also multi polygons), and then sums a column "Anzahl" from those selected addresses. The Sum is then written to the Polygon in the column ...
0
votes
0answers
55 views

How to edit attribute with my result from the count

I need this to loop through all the OBJECTID for the Fitting layer. Then it get the count for every line feature touching it. Now I'm at the point where I need the attribute table to be edited with ...
0
votes
1answer
257 views

Arcpy InsertCursor.insertRow crashes ArcGIS after many (thousands) insertRow calls

I am looping over a quite large feature class (~5million records) While looping using a SearchCursor, I insert new geometries in a FileGeodatabase FeatureClass using arcpy.da.InsertCursor. The ...
0
votes
0answers
35 views

Selecting features from another shapefile using ArcPy cursors and SelectLayerByLocation?

Having the code below im trying to select all the table features from an school_enroll.shp that are within each bigger zones from the hs_bndy.shpwhen i use the arcpy.SelectLayerByLocation_management ...
0
votes
0answers
137 views

Running out of memory with arcpy.da.UpdateCursor()?

Could anyone let me know if they see why this would cause a memory issue? The user running the script let me know he got a message that he ran out of memory while the script was running. EDIT: ...
0
votes
0answers
169 views

Using ArcPy Insert Cursor with NEXTVAL of Oracle sequence?

I have the need to be able to set a value of a gdb table to the NEXTVAL of an Oracle sequence. I have to be able to do this through an ArcPy function that will also handle setting the ArcPy OBJECTID ...
0
votes
0answers
35 views

Multiple Together Several Fields, then Use Update Cursor

Is it possible to preform multiplication on several fields of an attribute table together and then use an update cursor to assign the resulting value to a specific field?
0
votes
0answers
309 views

pyspatialite, cannot update geometry

I'm trying to update geometry column with pyspatialite but it returns error: spatialite.dbapi2.IntegrityError: mypoints.the_geom violates Geometry constraint [geom-type or SRID not allowed] My ...
-1
votes
1answer
193 views

Counting non-null attributes using ArcGIS Field Calculator?

I have an ESRI featureclass with a lot of records that have been scored to certain criteria, although criteria have been left null for records where they aren't deemed relevant. I'm now trying to ...
-1
votes
1answer
96 views

Count and sum unique values with domain coded value

I have written a code for count and sum unique values. I am getting the unique values count on Field "SubtypeCD" by using following code only if I am using "row[0]" instead of "desc_Domain[row[0]]]"....