Questions tagged [cursor]

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

55 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
26 views

Transforming descriptive CSV data to known locations in GIS using Python

I have to transfer CSV data that describes a FROM and TO segment into spatial data. The segment descriptions do not follow any logical convention, but rather describe road junctions, places, or road ...
2
votes
0answers
149 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
239 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
77 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
71 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
35 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
351 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
351 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
1answer
44 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
14 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
1answer
49 views

Improving ArcPy script for ArcMap to only return rows of selected polygons instead of all polygons in layer

I am debugging a code provided to me that merges two polygons and alters the fields of "FID1' and "CALC_AREA." I have realized that the current code searches every layer in the map document for ...
1
vote
0answers
82 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
0answers
281 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
182 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
121 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
247 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
233 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
45 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
45 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
670 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
93 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
776 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 ...
0
votes
1answer
157 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
1answer
21 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 ...
0
votes
0answers
43 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 ...
0
votes
0answers
18 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
27 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
44 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 ...
0
votes
0answers
42 views

Use arcpy.da.SearchCursor to iterate through values and count unique values in a Dictionary

I created a dictionary called Zip_Dict_Int and it contains file path strings as keys and zip code integers as values. The zip codes have been reduced to only the first number in the zip code. Below ...
0
votes
0answers
47 views

Selecting intersecting elements that have same value in another attribute and merging them into one using ArcPy

I have a polyline shapefile "rivers" containing three columns: [Start, End, Meas] [1, 2, 3] [2, 3, 3] [2, 4, 2] [4, 5, 3] [5, 6, 3] What I want to do is ...
0
votes
1answer
41 views

ERROR 000732: Layer Name or Table View: Dataset targetAreas does not exist or is not supported Failed to execute (SelectLayerByAttribute)

My goal with this script is to create 9 PDFs and 9 sheets within an Excel workbook. The script utilizes select by location, attributes, and searchcursors to read data to Excel and iterate through user ...
0
votes
0answers
28 views

Using search cursors with SQL in Python

I'm trying to create a search cursor that will list the cities in which the population is greater than 1,000,000. I was able to create a list of the cities and their populations, but unsure of the ...
0
votes
0answers
45 views

Getting “Workspace Already in Transaction Mode” Error when trying to use updateCursor on versioned sde

There are are numerous post on this error, but I can't seem to find a solution for myself. We have a versioned sde and need to add new fields to some of our feature classes and populate them with an ...
0
votes
0answers
50 views

Compare multiple lists of field names thought to be in shapefile with multiple list of fields found in shapefile

In the code below, I am able to create and print multiple lists that contain field names for each shapefile. This is done by creating a list of file paths, pointing to a shapefile, and looping through ...
0
votes
1answer
35 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
0answers
44 views

Using script parameter validation in ArcPy

I am developing a script to Add, Delete, and Update rows within a table. The script basic function works well using InsertCursor and UpdateCursor. My questions or troubles come when I attempt to use ...
0
votes
2answers
32 views

Update row based on order of parameter

I'm trying to add a field to a created feature class, then create a key based on whether the AccountNo is equal to the imputed Feature1 through 6. For example, if Feature1 is equal to the AccountNo ...
0
votes
0answers
76 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
0answers
86 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
120 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
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
47 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
21 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
42 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
2answers
154 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
44 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
61 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
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 ...