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

learn more… | top users | synonyms (1)

0
votes
1answer
66 views

error: “A network source with the specified name does not exist” in Arcpy UpdateCursor

I'm trying to edit an atribute table of a feauture dataset, but the error above appears when I try to execute the code below: gdb = r"C:\FILES\DATA\GDB\Olympic_Games_Cover.gdb" ...
0
votes
2answers
68 views

Selecting max(cursor) Value returns incorrect max from arcpy.da.UpdateCursor

I'm working through some da.UpdateCursor scripts to make updates to a fgdb. Although the script below works successfully as a rule, it returns the incorrect max value from one feature class. The ...
3
votes
2answers
110 views

How to Merge dbf files?

I'm beginner in python and learning it with examples. I have 100s of dbf tables like Type value1 value2 Type value1 value2 A 3 1 and A 5 7 B ...
1
vote
0answers
128 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
0answers
48 views

Update Cursor from TEXT to DATE field

I have column that contains dates that are created from a numpy array to fc, since numpy doesn't handle date types I have had to create another field to update the rows. When using this script in the ...
0
votes
2answers
34 views

Updating field in feature class with Search and Update Cursor:Stop Iteration error

I would like to update a field in a single feature class by a.) searching for a field where the values are not blank and b.) searching for a field where the values are blank. A typical scenario of ...
3
votes
1answer
44 views

Script for updating certain shapefile records meeting different conditions

This is my scenario: List of names in a python list: a[] A 1000 records shapefile with a column: 'name' (populated) A second column called 'value' ArcGIS environment (arcpy) I want to update the ...
0
votes
1answer
64 views

arcpy.UpdateCursor setting value to 0 instead of Null

I'm having issues setting a row value to 0 when joining a csv to a shapefile. When the shapefile value is not in the csv, the row is getting set to 0 instead of null. This is a huge problem as i'm ...
2
votes
2answers
89 views

Use Cursor to Calculate Field with Input Parameters

I have the following script that is used with a script tool to truncate each word in an input string and output the result to another field. There is an input parameter for the length of the ...
0
votes
0answers
45 views

ArcGIS/ Arcpy: UpdateCursor with only one feature

System: ArcGIS 10.3 with Python 2.7.8 on Windows7 x86 Background: Build a Python script do get drive times from the Google Maps DistanceMatrix and copy the results to an attribute table. The script ...
0
votes
1answer
77 views

Debugging syntax error (invalid syntax) from arcpy.SelectLayerByAttribute_management()?

I'm writing a script that will create a list of values from the field "Year_" using search cursor, and then a set() of unique values from the list. I then want to iterate through the set making a main ...
1
vote
1answer
67 views

Type error in arcpy SearchCursor

I'm trying to use arcpy SearchCursor to iterate through an attribute table, and the only fields that I'm interested are line_code, w_min and ang_ataque. This is not running properly because I got the ...
0
votes
2answers
99 views

Can I use my SearchCursor in Select by Location

I am trying to select the largest polygon that contains each feature in a feature class but none of the features in another feature class. I have written the code that seems logical to me but (of ...
0
votes
1answer
29 views

Update multi fields in multi shape files with arcpy

I have 3 shapefiles belongs to one state "District", "Mandal", "Village". These three shapefiles have the same fields like DName, MName, VName. I want to update all field in all shapefiles at a ...
2
votes
1answer
75 views

Using Search Cursor to calculate fields with records having a specific value

I'm a total beginner at programming and Python. I'm trying to select features by attributes and then field calculate in another field. In VBA it might look like this: If [Z1COMM] = "R" then ...
0
votes
1answer
65 views

Update record based on series of conditionals using Python

I have a feature class which I've been using a relate to compare duplicate field values and was thinking of a way to eliminate the manual process of checking these duplicate values and making a ...
1
vote
2answers
203 views

Arcpy.da.SearchCursor to retrieve the min and max measure values from Polyline-M shape

Is there a way to use a search cursor in ArcGIS to read the minimum measure and maximum measure values of a linear referenced route layer using arcpy? My goal is to build a route event using the start ...
2
votes
1answer
67 views

Calculate Row if Row Value Equals Value in List

I have a folder of photos named with a building ID that corresponds to a building ID in a building footprints feature class. Not all rows in the footprints feature class have a corresponding photo. ...
0
votes
0answers
29 views

Create individual feature classes for every record in a single feature class [duplicate]

I have arc desktop 10.3. I have a feature class (nycd) with 59 records in it. I'm trying to create a simple map with an inset that shows where each community district is located in that borough. I'd ...
0
votes
1answer
41 views

arcpy.da.SearchCursor, cannot read preceding zeros from csv

I'm using arcpy.da.SearchCursor to read a csv that has a column with preceding zeros, e.g.: myCSVColumn 0124578 12598 04589 012568 ... When using the arcpy.da.SearchCursor it returns the value w/o ...
0
votes
1answer
73 views

Making multiple fields NULL using Python in ArcGIS?

I have a repetitive task here at work. It requires that I make multiple fields NULL as I update the geodatabase. Is there a script I can write that I can input the fields and the feature class. Then ...
0
votes
2answers
94 views

Calculate and Restart Sequential ID for Unique Values in a Field

I need to calculate a sequential ID for unique values in a field. So, for the values in Field1, the sequential ID count should count all occurrences of that value, then restart the count for the next ...
0
votes
2answers
72 views

Finding empty attribute field with search cursor

I'm trying to iterate through all fields in my feature classes to find which fields are empty. I've had a go at using the SearchCursor (borrowing bits of code from other answers). This is what I ...
0
votes
2answers
65 views

UpdateCursor not calculating the date

My UpdateCursor isn't working in arcpy. Here's my code: urows = arcpy.UpdateCursor(firstDatabase+ os.sep + "Temp") for urow in urows: urow.Import_Date = time.strftime("%d/%m/%Y") ...
0
votes
1answer
196 views

Unknown Error? - A Column was specified that does not exist

shps = [(shp1,"field1"), (shp2,"field2")] for item in shps: shp = item[0] field = item[1] for row in arcpy.SearchCursor(shp, fields='"{0}"'.format(field)): if row == ...
0
votes
1answer
85 views

arcpy.da.UpdateCursor error: RuntimeError: create cursor has failed [closed]

I'm trying to delete a few rows in the output table that is created using the Compare Table tool (anything that has an ObjectID < 0). My script was working fine (i.e. it produced the table compare ...
0
votes
2answers
62 views

Creating a value-counting table with search- and update cursor

I'm a python beginner. I`m working with ArcGIS 10.2.2 and IDLE Python 2.7.5 I have a shapefile with around 20 fields, each attribute has a value between -3 and 3. This would look like this: I ...
1
vote
2answers
2k views

Changing field values with ArcPy update cursor?

I want to figure out how to be able to change values in fields for use in further projects. Right now , I would like to be able to add '-WA' to the existing field value 53. (ie 53-WA). This is a test ...
0
votes
2answers
72 views

Request for feedback on python script to increase efficiency with cursors

I’m new to python and would love some suggestions on improving the efficiency of my script. Background: My script is intended to create a report of the dominant and limiting soil types for ...
0
votes
2answers
56 views

How do I transfer one field name from text file to a new field name in feature class?

I am working on a script that involves incidents of fire. I'm taking my values from a text file that is comma delimited. The first line of the text file contains the field names ...
0
votes
2answers
44 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
97 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
37 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
146 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
85 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
67 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
226 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
80 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
281 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
327 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
72 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
234 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
34 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
670 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
87 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
205 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
202 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
64 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
104 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 ...