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

learn more… | top users | synonyms (2)

2
votes
1answer
71 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 ...
1
vote
1answer
40 views

IfeatureLayer.search() second time return error

I have the following method in my code and have a button that when clicked run this code. In the first click all of code runs without error. but in second run I receive an error on line: ...
1
vote
1answer
315 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 ...
1
vote
1answer
153 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
1answer
18 views

Script with searchCursor crashing arcmap

I was trying to make a script that counts the max lenght found in each field of a table with data in it, but it immediately crashes arcmap upon executing I know there might be a tool available on the ...
0
votes
1answer
63 views

Calculating well densities in selected counties using ArcPy?

I'm new in python and I have no clue how to do this. I am trying to calculate: total numbers of wells that fall into each county in a shape file, and update the county table with the total count. ...
0
votes
1answer
58 views

Using InsertCursor and SearchCursor with Nested Loops

I have a script that's parsing through text within each record of a table/field, and inserting those values into field/records of another table. Here's an example of the text being parsed (from "...
0
votes
1answer
56 views

Attribute table updating using ArcPy cursors?

I have a line type shapefile representing the road network of a country. That the country has experienced more change in the road names is why I want to create a script that will help me make update ...
0
votes
1answer
35 views

UpdateCursor based on results from SearchCursor

i'm kinda stuck with an UpdateCursor. This is what I'm trying to do: each cell of a grid stores multiple answers that were given in a survey. For each cell I must choose only ONE answer, the one that ...
0
votes
1answer
93 views

How to append Extent object to existing dictionary key values?

I have a dictionary whose keys are map segment names, and whose value is a list of 3 field values. Using an arcpy.da.SearchCursor on the map segments FeatureLayer, I have extracted the extent object ...
0
votes
1answer
149 views

Using search cursor with ArcPy and Spyder?

I recently installed ArcGIS 10.3.1 (previously had 10.1 installed) and I am trying to run a script in Spyder 2.7 that has always worked and getting the below error: "Traceback (most recent call last)...
0
votes
1answer
126 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
1answer
95 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
1answer
31 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 ...
0
votes
1answer
18 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
110 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 ...
0
votes
1answer
78 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 ...
2
votes
0answers
38 views

Using Arcpy.UpdateCursor to delete adjacency rows based on a group ID

I have this sample file shown in the picture 1 below. it is a sample data set of a phone survey of drivers. I am trying to find out when those drivers started to drive. My main goal is to build a ...
2
votes
0answers
61 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, ...
2
votes
0answers
44 views

Multiple Cursors

Below is the sql statement which I have explained below. Declare Cursor c1 is select store_number ,0 as total_area,0 as BG_ID ,0 as store_geom from table1 where CLIENT_ID= 1 and ORG_ID ...
2
votes
0answers
254 views

Can I use a cursor to select two rows and compare attributes

Can I use the cursor search function to look at the first two rows in a table and select them so I can compare attributes and possibly merge them or change attributes? I am using ArcGIS 10.0
2
votes
0answers
297 views

Processing arcobjects cursor is taking long time

I am maintaining a code on arcobjects 10.1, and there is a bug happening. I have a code that is parsing through a cursor, and generate a where clause statement to run it on a second query. So the code ...
1
vote
0answers
39 views

Calculating polygon width ArcGIS 10.4

I am trying to calculate an average width of a large set of polygons. I found the script below researching the topic. The function is: def add_average_width(featureClass, averageWidthField='Width'): ...
1
vote
0answers
44 views

Pycharm cannot find reference 'SearchCursor' in 'arcpy.da'

Whenever I try to use a search cursor from arcpy in pycharm, I get this unresolved reference error. I should note that it was working fine earlier in the night, I have no idea what happened. I've ...
1
vote
0answers
39 views

Import csv value to an empty field in a point feature class

I have a .csv with three colums and a point feature class with an empty field that i would like to fill with a value of the csv. In the .csv i have 15 rows with a code. In the feature class just one ...
1
vote
0answers
26 views

Scripting cursor updates to ArcGIS Online feature is somehow failing

I'm charged with maintaining QA logs embedded in a feature on ArcGIS Online. Basically I just have to change some fields in the feature. The problem is that I wrote scripts using cursors to update ...
1
vote
0answers
80 views

Cursor help on large spatial query in PostgreSQL

I have two very large tables on which I want to perform a spatial query. UPDATE table_a SET att_1 = b.att_1, att_2 = b.att_2 FROM table_a AS a JOIN table_b AS b ON ...
1
vote
0answers
246 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 ...
1
vote
0answers
35 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 = arcpy.da.SearchCursor('...
1
vote
0answers
74 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
0answers
320 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
0answers
27 views

Q: cursor memory and fields therein

Theoretical Python question. Say you have an update cursor while-loop for a few selected records. While looping through the rows, at some point a nested if statement triggers an "addfield" event. The ...
0
votes
0answers
41 views

postgis iterate over rows (cursors)

I need to repeat the same set of operations for each road polygon by using an id (road_id): I have tested my code only on one polygon of geometry using a series of functions inside a WITH query: ...
0
votes
0answers
23 views

Not able to apply update cursor on OS MasterMap feature classes created using OS Translator II

I am using OS Translator tool to convert OSMasterMap GZ files to PostgreSQL database. The feature classes created are query layers and cannot be edited in ArcGIS. Now I am writing a code to add new ...
0
votes
0answers
47 views

To get field value from a first table and search it in a second table

I create a script that allow me to display field values from my first table. How can I get value display with print in order to serach it in a second table. If values displayed using print doesn't ...
0
votes
0answers
29 views

Trying to delete specific features within feature class

I am working with arcmap 10.2. I have a database that has a few feature classes in it. Within these feature classes, they have a field labeled as Height. Height is a string field that houses numbers (...
0
votes
0answers
78 views

arcpy UpdateCursor throws exception on geoprocessing service?

I wrote Python code that changes the state of a feature by ID. I am not using a Python Toolbox (.pyt). I wrote a python script and added it into a standard toolbox (.tbx). Using ArcGIS Desktop ...
0
votes
0answers
38 views

Finding duplicates of same point in feature class and only keep maximum of field using ArcPy?

I have a feature class with fields: Latitude, Longitude, Type, Magnitude, City, State, Comment. If Latitude, Longitude , and Type are the same, I only want to keep the record with the highest ...
0
votes
0answers
26 views

SearchCursor to find a feature that intersects 5 of another feature?

I am using ArcMap 10.2.2. Currently my code looks like this: count = 0 features = arcpy.da.SearchCursor(fc, subtype) for feat in features: if feat == (100161,): count += 1 print count ...
0
votes
0answers
37 views

Looping all features of cursor onto SQL Server feature class?

It might be me but I've been experiencing something weird. (I actually tried what suggested in this thread Arcpy MakeFeatureLayer won't loop with no luck) What I'm trying to accomplish is to use ...
0
votes
0answers
60 views

Using ArcPy Insert Cursor with NEXTVAL of Oracle sequence?

I have the need to be able to set a value of a gdb table to the NEXTVAL of an Oracle sequence. I have to be able to do this through an ArcPy function that will also handle setting the ArcPy OBJECTID ...
0
votes
0answers
51 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
0answers
32 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
0answers
31 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?
0
votes
0answers
847 views

How to use python in arcgis to create new layer from selection and export into individual maps

I am trying to create county level maps by looping through a master file for each county. However, I get an error message when I try to run the code. I'm not sure what is wrong with my code and I ...
0
votes
0answers
157 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
52 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 = float(arcpy....
0
votes
0answers
146 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 ...
0
votes
0answers
25 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 ...
0
votes
0answers
87 views

arcgisscripting - setValue error

I'm having difficulty isolating this problem - at the point I attempt to alter a record with update cursor, the script returns a 999999 error. I've tried running this script without ArcMap running in ...