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

learn more… | top users | synonyms

1
vote
2answers
144 views

Why is my cursor empty?

Yesterday I set up a Python script using a cursor on a layer. Today I've tried running again and no matter what I run it in, the cursor is empty. I've tried removing the query on the layer, tried ...
0
votes
1answer
42 views

Passing ModelBuilder parameter to update cursor gives ERROR 999999?

I have two point layers. I trust the geometry (read: x and y coordinates) from one of them, but not the attributes data. I trust the attribute data but not the geometry from the other one (the ...
0
votes
2answers
70 views

How to add XY point and update attributes with ArcPy 10.0

I would like to create a script tool that takes 3 parameters in ArcMap: Google maps coordinate (e.g. -33.876846, 151.215117) text string text string The coordinates would define the XY geometry, ...
1
vote
1answer
50 views

How to update the Z value using an UpdateCursor?

I have created the following script to mimic the ArcGIS 3D Analyst tool, FeatureTo3DByAttribute, which creates a 3D copy of a 2D feature class and sets the Z to a specified attribute. import arcpy, ...
0
votes
0answers
9 views

Importing XML Schema, Update/Delete Field Names

Presently, I am trying to write a script to import a XML workspace that contains the outline of schema. I want to create a tool/script that allows the user to import it, specify the number of certain ...
0
votes
2answers
32 views

RuntimeError: Underlying DBMS error ORA-00936: missing expression schema.tableName STATE_ID is not column in table?

I created a search cursor to retrieve some data from a feature class. The broken example shown below is used successfully in other scripts I created. The only difference that comes to mind is I'm ...
0
votes
1answer
27 views

Update Cursor not updating field correctly [closed]

I've got an issue with an update cursor not working correctly. The kicker is that when I dissolve by the field that isn't updating correctly, the output is actually correct. I have the same syntax on ...
2
votes
0answers
30 views

Updating Cursor to Include Newly Created Features

I am using ArcMap 10.1 and python to create cursor that starts at the one and only row of a polyline shapefile, some code runs to create a new feature based on the position of the exisiting feature, ...
1
vote
0answers
42 views

How to auto-increment attribute fields using cursors and conditional statements?

I am trying to create unique IDs for an attribute named "FACILITYID" (str) and have got a ton of help from related posts and online python tutorials. I selected the rows I wished to create unique ID's ...
0
votes
1answer
31 views

Changing field values using arcpy

Say I want to make my field buff_dist longer than by 400ft, I want to write a code that will go through the table and change the field value by adding 400ft to it's value. How would I write that? I ...
0
votes
1answer
26 views

How do SearchCursors sort records

How do arcpy searchcursors sort records if there is no 'sort_field' specified? It seems, on the surface, to sort ascending by the primary key. However, I don't want to base my script around this ...
1
vote
2answers
62 views

Does arcpy.GetParameterAsText() have a data type?

import arcpy # Retrieve input parameters inX = arcpy.GetParameterAsText(0) inY = arcpy.GetParameterAsText(1) inDescription = arcpy.GetParameterAsText(2) incidentsFC = "C:/Data/Yakima/Incidents.shp" ...
1
vote
1answer
39 views

How do you calculate a new field for a raster table based on value from a joined table?

I need to know whether it is possible to calculate a new field for a raster table based on a value from a joined table. Ideally I'd like to be able to accomplish this task without having to add table ...
0
votes
4answers
74 views

arcpy interate row, in a python script? SQL Select expression not working

I am creating a python script where I am trying to iterate over point feature class. I want to create seperate Feature classes from each individual day. So select daynumber and then export it to a new ...
0
votes
1answer
67 views

UpdateCursor stops after the first iteration

My arcpy script includes two updateCursor Objects. The first iteration of the "outer" coursor works fine, but the programm stops when it comes to the second iteration at updateRow(). Has somebody an ...
1
vote
1answer
17 views

The updateCursor doesn't update all the cells in the shp, just some of them

Dont know for sure what is happening, but when i use arcpy.UpdateCursor it only write some of the lines not all the lines. The code is: cursor = arcpy.UpdateCursor("FInal1a1.shp") for row in cursor: ...
2
votes
2answers
64 views

arcpy.da cursor : iteration not started

I am trying to convert cursors written in 10.0 to use the new arcpy.da module in 10.2.1. If I step through the code in debug mode, it steps into the for loop; however, when I attempt to run the code I ...
4
votes
1answer
92 views

How to add Attributes to a polygon with arcpy

I have a question about arcpy. I want to create a polygon FeatureClass with attributes. The code below is just test-code that generates some polygons for speed testing. I want to add some additional ...
2
votes
1answer
64 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
35 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
28 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" ...
0
votes
1answer
43 views

limit spatial extent of arcpy cursor

How do I limit spatial extent of features that is returned by arcpy.da.SearchCursor? Can I use arcpy.env.extent? Or somehow come up with sql statement to specify spatial relationship? Or do I have ...
1
vote
1answer
68 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
70 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
27 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
36 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
48 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
46 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
38 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
39 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
89 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
61 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
98 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
50 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
42 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
40 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
68 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
283 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
296 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
95 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
115 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
52 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
112 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
220 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
107 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
90 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
79 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
415 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
155 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
186 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 ...