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

learn more… | top users | synonyms (1)

0
votes
2answers
20 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 ...
1
vote
1answer
35 views

InsertCursor fails when trying to insert XY point data

I have a text file with X and Y coordinates, as well as a third piece of information. I'm trying to create a point feature class from this text file by use of an insert cursor. I'm working with ...
0
votes
1answer
28 views

insert rows not displayed in arcmap

I am selecting rows from one shape file and inserting to other by using below script executed from PythonWin. Both shape files have same structure. Records are properly inserted and able to see them ...
1
vote
1answer
29 views

What is the most efficient way to get the values of a previous row in a table using ArcPy? [duplicate]

I am very new to ArcGis and I would like to get a specific value of the previous row in a table. I found this question here on gis.stackexchange.com and experimented a little bit. However, I found ...
1
vote
3answers
59 views

Python says my shapefile does not exist. Why?

I'm working on a script that prints the names of hospitals that are within a certain zip-code. When I run my code, though, python keeps giving me an Error message that says that my Hospitals shapefile ...
2
votes
1answer
35 views

How do I combine a wildcard command along with %s in a where clause statement?

I am trying to write a script where the user can search for a five digit zipcode using an input statement and a search cursor. The zipcodes in the file though are nine characters long (i.e. ...
2
votes
2answers
35 views

Debugging Cursor object has no attribute _exit_ from ArcPy?

I am trying to replace NULL values for -999 in a table inside a gdb. I know how to replace the value for individual fields, but get an error when looping through the complete table. import arcpy fc ...
0
votes
0answers
34 views

arcpy.da.UpdateCursor error: The required operation is invalid on a closed state

I have created an python toolbox to allow users to link a selected polygon to a image file. The user starts a versioned editing session, creates the polygon, browses to the image file and executes the ...
0
votes
1answer
40 views

How do I specify a spatial reference when using da.InsertCursor?

When using an InsertCursor, I can specify a spatial reference per http://resources.arcgis.com/en/help/main/10.1/index.html#//018v0000002z000000. I'm using da.InsertCursor because that's what everyone ...
1
vote
2answers
66 views

Use Python to Find duplicate values in a feature Class and populate a field

So I found this python script on another post here and was trying to adjust it for my needs. I'm a very novice python user so I'm struggling with how to modify the script. I have a Feature Class ...
0
votes
2answers
47 views

Comparing field values of two feature classes using ArcPy?

I have an intermediate fc #1 that contains data that I would like to append to my production fc # 2(final output). When working with the data, I would only like to append data from my fc # 1that is ...
1
vote
1answer
41 views

Update Cursor with Date Issue [closed]

My dates (maxDate, minDate, avgDate) all print out with the correct datetime format, but I am unsure if the problem is how the loop is written to update the cursor. Error: line 102, in updateRow ...
3
votes
1answer
130 views

How to iterate through all geometries using a search cursor?

I would like to use a python add-in which uses a button click to iterate through each selected polygon one by one. The following code manages to zoom only to the first polygon. How can I adapt it to ...
1
vote
0answers
26 views

Sorting cursor made of Network Analyst outputs?

I have solved OD Cost Matrix analysis and I'm trying to access the results using da.SearchCursor with SQL sorting. The problem is that the result is not sorted at all. lines = ...
2
votes
1answer
56 views

How to delete selected rows using ArcPy?

I want to delete all rows in a feature class but remain rows 1 to 5. In other hand I want to remain first five rows and delete others. I know that I have to use search cursor and update cursor but I ...
2
votes
1answer
64 views

Polygon found with search cursor, but not update cursor

Here's my issue. I am doing two things with arcpy: 1) I search a feature class using arcpy.da.SearchCursor() and pull out a UID field and the geometry in WKB format for all polygons in the file, ...
2
votes
2answers
92 views

Proper syntax for Select Feature Layer by Location

Can someone let me know how I can use a single feature from one layer as the "Select Features" when using the Make Feature Layer by Location tool with another layer as the input? In the code below ...
1
vote
1answer
78 views

arcpy; Select by attribute with an If, then statement

I am looking for some advice on how to construct an if, then statement based on a select by attribute SQL query or some other method (search cursor?). I am asking users to input a unique ID ...
0
votes
1answer
50 views

Getting wrong results in Search Cursor of ArcPy/Python script? [closed]

I have two functions: First one will crated the feature layer second one will access the same created layer and prints the result. when i run my script first time it will print the wrong results. ...
3
votes
1answer
52 views

Releasing Cursors using ArcObjects?

I am working with ArcObjects, in particular the ICursor Interface. I am creating a cursor and looping through a query's result set. My problem/concern is how to close or delete or release the cursor ...
0
votes
2answers
68 views

Attribute field based off intersecting polygon

I need to add a polygon for each bookmark (which works fine) and then attribute a field based off which Zip Codes the bookmark polygon intersects. I dont know if I am on the right track. The code ...
0
votes
1answer
43 views

Error using UpdateCursor to copy a GlobalID field

I am trying to use an Update Cursor to copy a GlobalID field into a string field. However, I keep getting an error saying "Objects in this class cannot be updated outside an edit session [Medians]". ...
2
votes
4answers
75 views

How to create new feature classes from rows in a polygon feature class

I'm trying really hard here to get an arcpy equivalent for ARCGIS' ModelBuilder's Iterate Feature Selection. I need to export the individual polygon rows in a feature class as new feature classes. ...
0
votes
1answer
58 views

AttributeError: __exit__ when trying to use arcpy.UpdateCursor

I'm trying to populate a field from values of an existing field in a feature class using arcpy.UpdateCursor. I'm getting this error: AttributeError: __exit__ Here's the chunk of code I'm ...
0
votes
1answer
76 views

UnicodeDecodeError: 'utf8' codec- arcpy

I work with arcmap 10.3 and python 2.7.8. I have more than 500 shapefiles that located in many folders and subFolders. All Sub Folders are located in one large directory. I try with arcpy to detect ...
0
votes
0answers
22 views

Spatial filter taken more time for running any other way to improve speed

I had number of buildings in data (around 600000) i want to check if any building captured less than shape area 25sqm should snap to existing building. i have used spatial filter but it is taken more ...
0
votes
1answer
41 views

Arcpy to append results of pivot table

Good Day All, So I have a script that does some processing but the main part are two things run a multiple ring buffer using arcpy.MultipleRingBuffer_analysis and four rings do some zonal ...
1
vote
1answer
61 views

Output the Search Cursor as a string

I am trying to select Zones that intersect the dataframe (polygon). If there is only one return then I want to turn it into a sting. If there is multiple I want to turn it into a string with " ," ...
-3
votes
1answer
110 views

Python script with ArcPy cursors won't stop looping?

I am running my script in ArcGIS 10.2 for Desktop and it doesn't stop processing. The process is overwriting itself because I have to shut down ArcMap manually. How can I stop the overwriting as its ...
0
votes
0answers
41 views

arcpy fails to retrieve queried data from a layer using arcpy.da.SearchCursor

I am attempting to retrieve rows of data from an attribute table using arcpy. I have used a definition query on the data in ArcMap so that only one feature is present in the attribute table. I then ...
0
votes
1answer
52 views

Find and Replace python script to replaces values in attribute table? [duplicate]

I am working on a stand alone script in python that will allow to me to specify a shapefile and being able to find a value and replace it with a new value. Does anyone know what code will allow me to ...
-1
votes
1answer
75 views

searchcursor only takes first value in field

My script ArcGIS 10.2 is using the searchcursor to read the mLanduse feature class to return the value in lField, but it is only returning the first value in lField to populate the sField in mSoils. ...
0
votes
3answers
61 views

Creating layers for each attribute value via Arcpy script

I'm having some trouble starting this script. Not sure how to start, as I have to create/output layers for each attribute value from a certain column named that has integers. They are all unique ...
1
vote
1answer
105 views

Spatially Joining Many Shapefiles. Use Spatial Join or UpdateCursor?

I have a large number of tree records in 100s of point shapefiles. Each shapefile contains a number of trees that fall within 10-50 parcels. The parcel layer contains ~60,000 shapes. For each point ...
0
votes
1answer
58 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 ...
-1
votes
4answers
158 views

arcpy search cursor not working

Im running my script in ArcGIS 10.2 and the dialog window says completed, but the empty fields in the 'SoilsType' row of the 'mSoils' Feature Class aren't getting populated with the values from the ...
1
vote
1answer
52 views

Exporting shapefile to csv with cursor

I'm trying to export a shapefile to a csv file using a cursor. I found this quesion asked and answered here: Exporting table to XYZ ASCII file via ArcPy? However I only want to export several ...
2
votes
2answers
64 views

Controlling default value of arcpy.AddField_management

I have a large collection of shapefiles that use text fields to hold numerical values. I have created new fields, and populated them with the numerical equivalent of the text field. When adding the ...
0
votes
1answer
13 views

Using Update_Cursor to fill new field

The goal is to crate a new field call "Full_Address" in which the "ADDRESS", "CITY","ST_ABREV" all appear together. I can get use row.getValue for 1 field but not more. import arcpy in_table = "C://" ...
0
votes
1answer
47 views

Python error in search cursor function

I need to access the dbf file to extract variable list (i.e. "CODE"). Basically I am calling dbf file to allMamrows variable and then I am appending using for loop. On running the script I am getting ...
3
votes
1answer
149 views

Arcpy.da.UpdateCursor, Error - Sequence size must match size of row

I am trying to use an UpdateCursor fill in a field but I keep getting an error, can anyone tell me what I am doing wrong? My code is below: import arcpy fc= "C:\Users\Keri\Desktop\GEP_690\Project ...
0
votes
1answer
98 views

Updating field in feature class using ArcPy cursor?

I want to update a field in my feature class. I tried to use a da.SearchCursor (code below) but was quickly reminded that tuples are immutable... I ran the code but it failed with a TypeError: 'tuple' ...
0
votes
1answer
34 views

update cursor datetime if start date greater end date

I have 2 date fields in my feature class. If the start date is greater than the end date, I want to add 24 hours to the end date. I am getting a SetValue error. cursor = arcpy.UpdateCursor("PolyFc") ...
0
votes
0answers
22 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?
1
vote
1answer
92 views

Using Update Cursor?

I am currently trying to get my update cursor to populate every row in each attribute table for 175 different feature class fields. I have written the script and it is populating the first row but all ...
0
votes
2answers
135 views

Update Multiple Columns within One Update Cursor

Are you able to update several fields within an attribute table at the same item within one Update Cursor command. Code Example: with arcpy.da.UpdateCursor (fc, fields) as cursor: for row in ...
0
votes
1answer
100 views

Check field type and execute depending on it using ArcPy?

I had a script that converted data from a clients site to a usable GIS format until they changed the output. I've tried two different directions with no luck. Due to how an earlier part of the ...
2
votes
1answer
50 views

Is it possible that ArcObjectsed ITable.Search hits default table version but cursor iterates over the edited current version of the table?

I'm very new to ArcObjects and working on an ArcMap addin. I'm having some trouble with understanding the results I'm receiving from my queryFilter. It seems doing a ITable.Search(queryFilter, true) ...
0
votes
1answer
127 views

Inserting row into table and then updating it in sum of each column using ArcPy?

My problem is the following: I have a table with an unknown number of columns (n) Use arcpy.ListFields create a list of columns and generates Field name list Then, using arcpy.da.InsertCursor create ...
3
votes
2answers
545 views

How to calculate a value based on another field under arcpy.da.UpdateCursor and cursor.updateRow?

I am trying to do a calculations under arcpy.da.UpdateCursor. I want to calculate the values for the records that have FIPS=06037. I want to take the values from "kg" column and populate the new value ...