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

learn more… | top users | synonyms (2)

1
vote
1answer
17 views

Search and Update Cursor Automation: Avoid <Null> Values and Recognize Data Values

I am attempting to Search Cursor through a joined table. (I do not have access to the original separated tables) If the value of "COMPANY" and "DATE_" are then they will be skipped and it is ...
2
votes
1answer
14 views

Arcpy Update Cursor with Character Length

I am attempting to create an update cursor to concatenate fields of a parcel ID based on the amount of characters in the MAPNO field. This is important because the spacing between MAPNO and LOT of ...
1
vote
1answer
27 views

count if a row value is within a dynamic range?

I am after doing a COUNTIFS in python. I need to check each row ± 250 with other rows and if this row is between that range then count 1, then next row, .. and do the same thing. and if there are any, ...
2
votes
2answers
63 views

Update Cursor: Unable to populate specific field

I am attempting to create a loop to recognize the entry/exit point of a pipe to/from a structure by associating it with a North, South, East, or West direction and then populate the corresponding ...
0
votes
0answers
27 views

Using python to write on attribute tables of ArcGIS? [on hold]

I had an ArcGIS model (ArcGIS 10.2) and I used Python scripts (Python 2.7) to make calculations with values from attribute tables. Now, I need to put results of python on new attribute tables of the ...
0
votes
0answers
45 views

Can I use those values to for 'cursor.next()' instead of returning the next value based on FID? [on hold]

This is a line feature. when I excute the script below cursor = arcpy.da.SearchCursor("contour_lines_SmoothLine1", "*") for row in cursor: print row I got somthing like that (0, ...
-4
votes
0answers
54 views

can't get tuple to run [duplicate]

I am having some trouble getting my code to run particularly for my tuple. I am trying to get the distance from any city to a lake by calculating the minimal Euclidean distance from the city ...
3
votes
3answers
203 views

Duplicating polygons in Layer using ArcPy cursors gives AttributeError: 'tuple' object has no attribute 'getValue'?

I am trying to Duplicate some polygons in the same layer with the same attributes, But it will duplicated them with Null Geometry, i have tried getValue() method, but i got error import arcpy ...
1
vote
1answer
41 views

How do I get arcpy.Select_analysis to skip conditions that don't exist

I have data from 2007 to 2015 of various animals that I'm trying to break up by year and name. I wrote a little for loop that goes through all the items in my attribute table (gps_points). The ...
2
votes
0answers
28 views

How to get 4 values for different Indexes and names of rasters for set of points? [on hold]

I am trying to get 4 values for different Indexes and names of rasters for set of points, but get problem with defining function def extractIndex(raster, pathName). #List of Folders 4 Folders ...
1
vote
1answer
24 views

Getting NameError when using Cursors to read vertex coordinates in ArcPy? [on hold]

I am new to python and having trouble Looping each feature in the new polygon shapefile, then use geometry cursors to read vertex coordinates of this lake polygon, identify the city that is the ...
1
vote
2answers
101 views

Scripting (Python) Feature Class content into Shapefiles following an UTM data structure

Consider a Feature Class and two of its fields are "UTM_grid" and the "OID". Scripting with python 2.7 for ArcGIS 10.3. "UTM_grid" field contains the geographic info (e.g. B1SD40B) and was broken ...
2
votes
2answers
23 views

Reference Items in Generated List for Multiple Record Selection and Iterate

I'm new to Python and am having trouble with a list of all things. The data I am currently working with consists of multiple road segments (contained in 'STREETNAME' field) each of which has a ...
1
vote
1answer
33 views

Updating Field to Calculated Variable using Arcpy

I'm trying to use the updateCursor to insert a calculated value in the correct field. However, I keep on receiving an execution error. I think it is an easy fix, but I am new to arcpy and cannot ...
2
votes
1answer
36 views

ArcObjects in ArcMap 10.2.2 UpdateCursor refer to a calculated field value in the same Cursor

Is it safe to calculate a field value inside an update cursor and refer back to this calculated value to change another field value of the same row? I think some code will actually explain my ...
1
vote
2answers
16 views

trying to update empty string field with a string

I need to update a column of values such that empty fields are changed to the string "OFF_ROAD." I've looked up a plethora of examples, and this is what I'm trying to get to work, but when I run it, ...
1
vote
0answers
36 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 ...
0
votes
2answers
27 views

Getting name of raster in point shp.file Attribute Table using ArcPy? AttributeError: 'unicode' object has no attribute 'contains'

I am trying to get name of raster for corresponding point if point belongs to raster and fill column "name" in points Attribute Table: but no names in Attribute Table column "name" of point's ...
0
votes
1answer
52 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 ...
1
vote
0answers
21 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 ...
2
votes
2answers
44 views

editing and manipulating tables with python

I’m new to ArcMap and was wondering if anybody could help me out. I have a shapefile with counties and wells in that county. In the table I’m trying edit it so that for each county calculate the total ...
1
vote
1answer
39 views

Comparison between two fields of two tables using ArcPy cursors?

I would like to make a comparison between two fields of two different tables with a Python script. Fields for comparison are ROAD_NAME and NAME.ROAD. The idea is to check whether each element of ...
4
votes
1answer
169 views

Generic error on an “if” in arcpy

My code has to check if a value in a shapefile attribute table belongs to a certain group of landuses. Below I paste my code: cursor = arcpy.SearchCursor(buf_intersect) fields = ["GTYS_Branc", ...
3
votes
1answer
282 views

Alternative to an arcpy script for points to lines to polygons?

I'm relatively new to arcpy and python, so I feel like I could be missing something obvious in regards to tool options for what I'm trying to achieve. I have a script that creates triangular ...
0
votes
1answer
32 views

Automation KeyError using Search Cursor / Data Dictionary

I recently received help in modifying a previous code for structures as part of project. The first time I ran it the code worked fine, but when I went to double check it. I keep receiving: ...
0
votes
2answers
193 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
2answers
102 views

Attribute field based off intersecting polygon

I need to add a polygon for each bookmark (which works fine) and then attribute a field based off which Zip Codes the bookmark polygon intersects. I dont know if I am on the right track. The code ...
1
vote
1answer
28 views

The same value for X and Y in Attribute Table

I want to extract X and Y coordinates of points from shp file - infc, and put them to corresponding columns in Attribute Table. My code just give the same X and Y for all points in Attribute Table: ...
2
votes
2answers
71 views

Update Cursor for automation of tedious data entry which keeps crashing ArcMap

I coded the Update Cursor for automation of tedious data entry where I am applying a previous Survey Company Identification Data to STRUCTURES_15096.shp from "OFFICIAL_STRUCTURES2015.shp" and it keeps ...
-1
votes
1answer
48 views

Insert Cursor not creating polygon

I used this code to create a polygon in my map, but the polygon isn't showing up anywhere. Does anyone know why? Here is my code: fc = "U:\BuildingFootprints.gdb\BuildingFootprintsCopy" cursor = ...
0
votes
1answer
68 views

Having arcpy.da.SearchCursor access only selected row in attribute table?

In ArcMap 10.2, I'm attempting to build a tool that, when run, will iterate through a network of pipes to locate an outfall point. My network is composed of polyline data representing pipe, with input ...
0
votes
1answer
529 views

Polygon Neighbors Analysis script (ArcPy 10.1) producing erroneous results?

I'm struggling with a python script that is supposed to calculate a field for a polygon feature class. The calculation is of the average of a field value (P_TOT_DEV) for each of a given polygon's ...
3
votes
1answer
243 views

Selecting rows in a layer using arcpy.SearchCursor

I'm working on a project to identify points that fall along lengths of road. The roads are stored a single featureclass within a file geodatabase, as are the points. I'm using ArcGIS 10.3. I'm trying ...
1
vote
0answers
51 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 ...
3
votes
3answers
2k views

How to calculate a value based on another field under arcpy.da.UpdateCursor and cursor.updateRow?

I am trying to do a calculations under arcpy.da.UpdateCursor. I want to calculate the values for the records that have FIPS=06037. I want to take the values from "kg" column and populate the new value ...
1
vote
1answer
56 views

updating field based on another field with arcpy.da.updateCursor

My code is very simple and it should work, but it doesn't. Perhaps another set of eyes can solve my issue... I created new field (this part works), then look up value of another field and depending on ...
2
votes
1answer
52 views

Convert searchcursor object to variable

Using a python script, i would like to read through a table which features 27 columns. For each row i want to store the value of each column in a variable, so that i can pass the values to a ...
0
votes
0answers
32 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 ...
1
vote
1answer
524 views

Workspace already in transaction mode

I am writing a script to use an updatecursor. The feature class is locked so I am versioning the database, creating a feature layer, and reconciling versions. I have taken the skeleton for my ...
0
votes
1answer
55 views

Python Calculate Cumulative Polygon Areas (Basins)

I've been asked to automate the calculation of cumulative polygon areas within a basins shapefile. The calculation will take the area of the upstream basin and add it to the area of the downstream ...
0
votes
1answer
34 views

Problems passing where clause as variable?

I'm having trouble passing my where clause for arcpy.SearchCursor as a variable. The following code successfully generates a query for me: PolyList = "C:\\Users\\korora912\\Desktop\\polygons.shp" ...
1
vote
1answer
613 views

How to use InsertCursor to add points to a point feature class?

I am struggling with a very simple task of inserting "SHAPE@XY" into a point feature class. Following is what I have: xy = [(361087.15436001675, 198747.07296730898), (361530.56426259346, ...
4
votes
3answers
359 views

Why [0] is needed in row[0] when using ArcPy (Data Access) cursors?

when running the following 2 sample codes, "[0]" is needed to be added after "row" in order to make code run well. I was confused. can anyone help explain? I know that it might be too easy for most of ...
3
votes
1answer
4k 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 ...
1
vote
2answers
41 views

Cannot insert data into my feature class

I'm using Arcgis 10.1 and I created my script for inserting data in my feature class but I got this error message: Traceback (most recent call last): File ...
0
votes
1answer
113 views

arcpy.da.UpdateCursor updating field based on the previous row

I am quite new to python. As you can see from the image attached to this post. I have polylines with From junctions (fnode) and to junctions(tnode) field. My goal is as following: To update draw ...
0
votes
1answer
48 views

Writing attributes and associated feature class name from file geodatabase to CSV?

I need to write a csv file that lists every record from an ID field across all feature classes in a gdb. The code I have written below does that fine, but I also need to write in the second column of ...
2
votes
1answer
70 views

Developing find and replace script tool?

I'm being tasked for developing a script tool that can find ultimately needs to be able to find any string and replace it with another string in an attribute table. Below is what I have so far, and it ...
1
vote
1answer
38 views

Deleting Duplicates from Multiple Tables in a GeoDatabase

I'm having trouble deleting duplicates from multiple tables in a geodatabase. I have a field "facility_id" which should be unique, but I have multiple entries and need to delete all but one. I've ...
1
vote
2answers
54 views

Looping fields in an update cursor

I'm running an update cursor on an in_memory feature class to remove blank (but not null) values as part of a larger process. I wanted by update cursor to loop through my list of fields and if the ...