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

learn more… | top users | synonyms

15
votes
2answers
2k views

Exporting table to XYZ ASCII file via ArcPy?

I'm looking for a way to export an ArcGIS table (created with the Sample tool) to a text file via ArcPy. I can do this in ArcGIS via the context menu by right-clicking the table, but have not found ...
4
votes
1answer
816 views

Is it possible to sort an arcpy.da.UpdateCursor()?

I have an ArcPy Data Access update cursor that I would like to sort before making updates to it. The cursor makes updates if I don't sort, but if I add a sort to the cursor I get an error, ...
3
votes
2answers
714 views

Move the cursor backward - opposite of row = rows.next()

I'd appreciate if anyone could please tell me if there is a way to go up one row in python cursor. opposite of row = rows.next() Thank you!
12
votes
2answers
333 views

How is the data access cursor performance so enhanced compared to previous versions?

The data access module was introduced with ArcGIS version 10.1. ESRI describes the data access module as follows (source): The data access module, arcpy.da, is a Python module for working with ...
9
votes
5answers
419 views

How to improve performance when using ArcGIS cursors in Python with big tables?

I have a pretty big point feature class in a file geodatabase (~4 000 000 records). This is a regular grid of points with a 100m resolution. I need to perform a kind of generalization on this layer. ...
3
votes
1answer
462 views

Using ArcPy update cursor to replace <Null> value?

I have been combing the help associated with (None) values in arc, and have not been able to solve the following problem: I have a a field with mixed Null and integer values: 0 100 I would like ...
4
votes
2answers
192 views

Is it a bad idea to convert a File Geodatabase table to a dictionary?

First, what am I trying to do? I am building a Python script that should be called from an ArcMap 10.0 toolbox. This scripts uses (among other inputs) data contained in huge gdb tables. It processes ...
2
votes
1answer
295 views

Only perform Near analysis on selected rows

I am writing a Python script to perform a near analysis on features from two different shapefiles with common attributes. This is happening in a Search Cursor. However, whenever I tried to use the ...
1
vote
2answers
132 views

Calculate Fields with Null Values using arcpy.da.UpdateCursor of ArcGIS for Desktop?

How do you calculate fields with null values? I have multiple fields that may have null values, that aren't being calculated in the third field. import arcpy with ...
2
votes
2answers
529 views

GROUP BY clause in the UpdateCursor arcpy.da

I need to specify a "group by" clause for UpdateCursor arcpy.da. From here I found out that it's possible to do using an optional pair of SQL prefix and postfix. But there are no examples and I'm ...
2
votes
1answer
372 views

Am I over-complicating adding and then calculating fields? Suggestions for a better way? (Python)

I'm attempting to re-position a question I asked yesterday here. I am starting to think that the way I wrote my code just isn't the best way. Am I overcomplicating things? I know for a fact that ...
2
votes
1answer
917 views

Incorrect field name resulted in RuntimeError: ERROR 999999 (Also, better code for adding and calculating fields)

This is the bottom half of my code (and it's been edited somewhat to share publicly). The code works perfectly fine when the fieldList has only three fields in it, but when I populate it with all 108 ...
2
votes
2answers
463 views

Using select by location to update a field in a feature class

I am using Arc 10.1 and I am working on a script that takes a value from a field within one shape file and updates a field in another shape file based on its location. Basically I have smaller parcels ...
1
vote
2answers
44 views

building dictionary from feature class field values, how can I ensure there are no duplicate values per key

I found this code sample that builds a dictionary from two fields; the end result is a concatenation of all values per key to a new field. It's a great tool except that it doesn't account for ...
1
vote
3answers
388 views

Does arcpy.SearchCursor function support field indexing?

Does the arcpy.SearchCursor function support field indexing? In the sample script below, can I sent my cursor to loop through the values in the first field by setting an index to search the first ...
0
votes
1answer
40 views

Updatecursor returns with 'variable not defined'

I am fighting a bit with the cursor function since this morning. Thanks to the help of the people here and some tutorials I found I got this far import arcpy arcpy.env.workspace = ...
-1
votes
2answers
255 views

ArcPy: (SearchCursor/export to tiff ) with no output [closed]

I'm trying to write a script that uses a search cursor to loop through a field in a .shp file (Incident_Z) find every value that meets a specific condition (zip code=10004) and then at a scale of ...