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

learn more… | top users | synonyms

2
votes
1answer
38 views

Do I need to set arcpy.env.workspace at the beginning of my python code?

I am new to Arcpy and have been doing simple tasks such as AddField_management and updateCursor. However I have been getting error msgs, such as errors 99999 etc. The errors I get are related to ...
2
votes
1answer
29 views

arcpy cursor not accepting float(Inf)

I have a vector layer in which I have added some fields of type 'float' using arcpy.AddField_management. I'm performing simple calculations between those fields using update cursors but the problem is ...
3
votes
1answer
24 views

ArcMap Using Python to Rename a Feature Class based on Print Results

I would like to rename a feature class based on the EDITOR and DATE fields. I wrote this code: import arcpy fc = "C:\Users\PythonTesting.gdb\MyFile" f1, f2, f3 = "EDITOR", "DATE", "OBJECTID" ...
1
vote
1answer
60 views

Problem with Nested For Loop in ArcPy

I have two vector layer files, 'hausnummer_cropped5' and 'gebaudepoints_cropped5 - Kopie2'. Both have a point geometry and I am trying to shift the locations of the gebaudepoints_cropped5 points onto ...
1
vote
2answers
50 views

How to get a search cursor on a particular version in arcpy

I have a versioned database in ArcGIS and I am wondering how can I tell arcpy what version to query. The closest I have got to an answer has been building a particular connection file that specifies ...
0
votes
2answers
14 views

How to set values from list to row using arcpy

I have list with values and I want to put them in rows for specific column. Here is my code: den = kol() # list with values with arcpy.da.UpdateCursor('Wojewodztwa', 'gest_zal') as cursor: for ...
0
votes
2answers
32 views

Randomly assign a value to a specificed number of rows in a feature class in ArcGIS

I have several feature classes, each with a million or so rows. In each of these feature classes I have an attribute ("STATE"), the value of which I want to randomly assign to one or another state (so ...
0
votes
1answer
36 views

arcpy insert cursor problem - adding multiple polygons

I am reading rows from a database with a field "Coords" that contains polygon coordinates in the format 40.090170,-83.007704|40.089878,-83.007724..... and inserting each row as a polygon. The first ...
0
votes
0answers
38 views

Issue with da.updateCursor on shape

I recently posted answer Determining Y coordinate for Create Fishnet from desired Angle of Rotation in Python/ArcPy? . While working on it I found something weird with da.updateCursor on shape field. ...
0
votes
0answers
32 views

GetParameterAsText() with Cursor

I'm trying to use the GetParameterAsText() for user input. When I use a value instead, it works fine but not with GetParameterAsText() Any help will be greatly appreciated AreaFilter = ...
0
votes
1answer
32 views

table update w/ cursor geometry conflict

I'm creating a table using arcpy with a list of results (stored in 2d lists) following an update to some features. This can sometimes include geometry, so I've attempted to substitute those for a ...
0
votes
1answer
56 views

Convert python from arcpy.da.SearchCursor to work in 10.0

I am using code such as for row in arcpy.da.SearchCursor(polyFC, ["SHAPE@"], spatial_reference=SR): # create inner buffer polyBuff = row[0].buffer(buffNum * -1) # create hull rectangle to ...
2
votes
1answer
57 views

Combining duplicate points while preserving their associated attributes

I'm working with building routes for a lit of technician's stops. In some cases, they have two "stops" at the same customer location -- turning on two types of service at a house, for example, is ...
0
votes
2answers
79 views

Same python code works in arcgis python window, but fails in pyScripter

This code works in the arcgis python window but in PyScripter, this warning message had been written: Traceback (most recent call last): File "", line 16, in File "C:\Program Files ...
2
votes
1answer
47 views

Trying to preserve attributes using SearchCursor

I am writing a python script for ArcGIS. I'm fairly new to this so I hope I'm not missing something very obvious. I am having trouble preserving the attributes of a polyline feature class when ...
0
votes
1answer
39 views

Sorting an UpdateCursor [duplicate]

I'm trying to sort a dataset by field StartTime (datatype date, indicates when a technician is supposed to start a visit). I am including a SQL where_clause to avoid an earlier problem when it ...
1
vote
0answers
32 views

Error writing defaultdict values to feature class rows

I originally posted building dictionary from feature class field values, how can I ensure there are no duplicate values per key. The goal is to update another field with all the values per key, which ...
1
vote
2answers
53 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 ...
2
votes
2answers
184 views

Use updatcursor to replace values in multiple fields

I have spent a couple days digging through forums here, ESRI help and elsewhere and each variation of the codes I have tried has not worked. As best as I can tell this is due to my attempt to loop ...
1
vote
2answers
224 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
1answer
73 views

Python Use SearchCursor/InsertCursor to split attributes in fields

I download data daily and create a geodatabase table. Fields: Company, Customers_Active, Customers Total, County, State Example Data {CompanyA,CompanyB}, {141,424}, {1000,3421}, Cook County, ...
1
vote
0answers
84 views

SQL Prefix for arcpy.da.SearchCursor

Does the sql prefix - DISTINCT work well on SDE tables? http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000011000000 Syntax: SearchCursor (in_table, field_names, {where_clause}, ...
1
vote
2answers
49 views

How to skip over errors created by cursors running through empty tables?

I am trying to automate the creation of many different feature layers were their content is created by a cursor. Sometimes during the automation, a feature layer may be empty, this is okay, but as the ...
4
votes
1answer
88 views

How to extract certain values from a table using the SearchCursor Tool

I am trying to write a python script to extract certain values from a table: the table I am referring to is a big collection of nitrate values for different water depths, which are deposited in the ...
3
votes
3answers
170 views

Using da.SearchCursor to get count of unique values in a field

Is it possible to use arcpy.da.SearchCursor() to get a count of unique features in a field without a dictionary? So, by this I mean if I have a field called TEXT which contains 10,000 rows populated ...
3
votes
1answer
89 views

Copy multiple features in feature class, update field value based on number copied

I have created a field which will indicate the records I want to alter. What I want to do is then cycle through these records, each will contain sum values in a field.Based on the sum I want to copy ...
1
vote
1answer
79 views

Subquery in SearchCursor with ArcPy?

I'm searching for the value from the field "demA_demA" which has the lowest elevation by having the value 8 from the field "outTable_2". How can I do this in the following script. import arcpy ...
0
votes
1answer
70 views

Using insert and search cursors on same feature class to clone row?

I'm using the code below in order to attempt to clone a row in a feature class and add that same row to the same feature class after updating its metadata (Name, date_start, date_end, etc.) The ...
12
votes
2answers
369 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 ...
1
vote
2answers
108 views

Debugging SQL in arcpy.da.SearchCursor RuntimeError: An invalid SQL statement was used?

I am going through a python script in arcpy 10.1 to Select a field value (i.e. NEAR_DIST) based on three condition as 1) NEAR_DIST<=radius(i.e.500 or anything from user input) 2) ...
0
votes
3answers
119 views

Using search cursor to determine renaming of feature class

What I am trying to do is create a list of shapefiles based on field name values. From there I would like search on 1 field (each shapefile will only contain 1 row) and if the value in that field is ...
1
vote
1answer
43 views

Updating records in a table using GetCount and an Update Cursor

What I have is a buffer which is then used to select a number of point features which intersect the polygon. I would like to take that number and add the value to a table. The row where the value will ...
1
vote
1answer
54 views

Using update cursor with list of shapefiles

I'm still pretty new to using cursors. What I'd like to do is create a list of shapefiles. Within those shapefiles I would like to populate a field "NAME" with the shapefile name less the .shp ...
3
votes
2answers
226 views

ArcPy Data Access Insert Cursor not writing geometries to feature class?

I'm running ArcGIS 10.2.1 and am having troubles with the Insert Cursor in the arcpy module. I have an empty feature class in my geodatabase and have created the short script below to try and find the ...
0
votes
1answer
412 views

Create polylines from point array Python

I am working on building polylines from an array of points I have created from a csv file and am completely lost in building the lines. My code works as follows: I have the point array working, I need ...
6
votes
5answers
191 views

How to access adjacent rows with cursor?

In the attached screenshot, the attributes contain two field of interest "a" and "b". I want to write a script to access the adjacent rows in order to make some calculations. To access a single row, ...
0
votes
1answer
44 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
vote
1answer
51 views

SearchCursor returns strange value

my searchCursor look like this. arcpy.env.workspace = "C:\\Users\\Documents\\Scoring\\Ecodis_clip_split" #set workspace to folder with values eco = arcpy.SearchCursor ("NAME.shp", "", "", "area_ha", ...
0
votes
1answer
102 views

Updating records based on value in another field using arcpy.da.UpdateCursor?

I am trying to write file names and paths to two separate fields in a feature class, and the value for each record is dependent on finding a match in a list. When I run my code it writes the same ...
0
votes
1answer
60 views

Splitting the job on Arcpy SearchCursor

I'm running a for loop with a cursor to disaggregate a large feature class into many smaller ones (of one polygon each). ArcMap crashes after about 1100 iterations, and I am trying to break the job ...
0
votes
0answers
59 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
vote
1answer
308 views

How to Properly Loop Through a List With a Cursor?

My team is working on a python script that does various updating tasks to our streets file. A part we are getting stuck on is trying to update a field. Currently we have a field FEDROUTE that is ...
1
vote
2answers
313 views

How to copy data from one table to another using cursors?

I'm going to be as descriptive as possible. I have a table (TA) with values which are null for some rows, filled out for others. I have a table (TB) with the null values filled out. Dec in TA is the ...
4
votes
2answers
220 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 ...
0
votes
0answers
23 views

Using file directories from a table

I have a toolset that will be using a set of file directories as input (shapefiles, raster etc.).The table can be stored as CSV or DBF. Is there a way to read a specific cell (row,column) of the ...
3
votes
3answers
633 views

How to extract data using arcpy.da.SearchCursor

I have a shapefile of point features showing fire locations in a given year. One of the fields is named "YYYYMMDD" and indicates the corresponding date that that fire happened. In Python, I am trying ...
2
votes
1answer
127 views

Using the UpdateCursor to change the values in fields added with arcpy.Addfield_management

I am working with some ArcGIS data and trying to add fields using AddField_management. >>> arcpy.AddField_management("huc4","Class","TEXT") I want to populate this new field using the ...
0
votes
1answer
82 views

ArcPy - Add Layer from Cursor Selection

I am trying to add layers from the fields of a reference layer using select by location and a cursor. Also, want to prompt the user with a message box asking if they want to add the selected by ...
3
votes
0answers
84 views

Basic arcpy script with cursors running SLOW!

I've got 2 polygons layers (no gaps): IDUs and crops. What I want is to identify the 3 largest crops by % area for each IDU. This seems common enough but I couldn't find a way to do it all using ...
3
votes
1answer
519 views

Arcpy Update Cursor (arcpy.da.UpdateCursor()) not saving changes to 'SHAPE@LENGTH'

Looked around and found other Cursor questions, but nothing dealing with updating 'SHAPE@LENGTH'. I am running ArcGIS 10.2.1 and have a multipoint shapefile that I am grouping into polygons based on a ...