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

learn more… | top users | synonyms (2)

1
vote
1answer
25 views

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

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
1answer
38 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 ...
1
vote
1answer
50 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
2answers
27 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
2answers
26 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, ...
2
votes
0answers
30 views

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

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
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 ...
0
votes
2answers
29 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
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 ...
1
vote
2answers
117 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 ...
1
vote
2answers
129 views

Editing and manipulating tables with ArcPy? [duplicate]

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
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
1answer
61 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 NAME....
4
votes
1answer
176 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", "...
0
votes
1answer
55 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: ...
1
vote
1answer
34 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: ...
-1
votes
1answer
66 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 = ...
2
votes
2answers
83 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 ...
0
votes
1answer
129 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 ...
3
votes
1answer
51 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
0answers
81 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 ...
0
votes
1answer
63 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 ...
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
1answer
66 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
43 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
2answers
45 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 "C:\SIG_AS\Shapefiles\Projet2\MyScript\...
0
votes
1answer
144 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 ...
2
votes
1answer
40 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 ...
0
votes
1answer
71 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 ...
1
vote
2answers
65 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 ...
2
votes
2answers
73 views

Creating a list using an attribute query with arcpy.da.SearchCursor

I have a shapefile of a river network containing the following fields: toJunction, fromJunction, Int_DAM (which indicates free-flowing status) and Strahler. I'm trying to create a list of the rows ...
4
votes
3answers
377 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 ...
1
vote
1answer
73 views

Arcpy get values in the 2nd field of every table in a geodatabase

I have a geodatabase in Oracle with around 50 tables. I want to get the values in the 2nd field of every table in my geodatabase. I will be using the values in the 2nd field as an input for a ...
1
vote
0answers
26 views

Cursor update row operator [closed]

This is a find and replace script I have been working on. I feel I am very close, as the script does everything but actually change the values, leading me to believe there is an operator issue. I have ...
2
votes
2answers
120 views

ArcPy Calculate Null Values to Zero in Multiple Fields

I have a table that has Null values and I would like to insert a portion in my script to calculate these Null values to 0 in only a few of my columns in my table. Here is my script so far: with ...
3
votes
1answer
62 views

Calculating summary statistics and access resulting value in table using ArcPy?

With arcpy, I want to calculate the mean value of a specific field in a shapefile and print the resulting value for the user. I use the Summary Statistics tool and it works, but the resulting value ...
1
vote
2answers
117 views

How to keep a parameter blank in a script tool?

I've developed a sort of find and replace script tool that functions. But I'm not able to figure out how to find empty cells in fields and replace them.For the "Find" parameter, I have tried entering "...
2
votes
1answer
30 views

Problems with insert cursor

I am counting the number of features in a geodabase. I am triying to insert the feature name and the count inside a dbf table which has only two fields: "FEAT" (Text field which containts the feature ...
2
votes
1answer
79 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
69 views

Insert (or Update) Cursor setting value to None not honored when field has a default value

To set a field to null, the InsertCursor or UpdateCursor is setting the value to None. Here is a sample for the UpdateCursor: with arcpy.da.UpdateCursor(test_fc, ['SERVICEINDICATOR'], """"OBJECTID" =...
1
vote
1answer
70 views

How to update new column in attribute table with same values but different field type?

I am struggling a bit with debugging my code, over something that seems very simple. I am using an update cursor to copy and convert existing string data into a new float column of my shapefile's ...
1
vote
1answer
65 views

how to skip creating an empty feature class using featureclass to featureclass in arcpy

I have a script that finds points outside of selected areas and creates a feature class in a file geodatabase. However, sometimes there are no points outside of the selected area. Currently, the ...
2
votes
1answer
46 views

Arcpy “print” works only the first time [duplicate]

I am running this extremely simple code using the ArcGIS python environment: import arcpy test = r"C:\....\New_Shapefile.shp" #test contains several fields, including one called "Number". ...
1
vote
1answer
31 views

Replace Statistics_analysis with SearchCursor?

I'm using ArcGIS 10.3, 64bit with an advanced license. I have the following code, that runs just fine. It goes through a table that contains a large number of entries with zip-codes and population ...
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 (...
4
votes
1answer
48 views

Update row with next row's value

I am trying to extract the endpoint of a line with very fine scale and overlapping GPS data. I would normally just use the locn_id+1 but that doesn't work because the data were originally rarified. ...
4
votes
1answer
110 views

How to delete rows in attribute table of a shape file based on specific condition?

I want to delete ceratin rows in a shape file if field ID is equal to certain number (say 2). Below is what I am trying, import arcpy shape="C:\Users\Data\Loc.shp" rows = arcpy.UpdateCursor(...
1
vote
1answer
62 views

arcpy SearchCursor always empty at each loop when inserting new rows with InsertCursor

I am inserting new rows into a POINT FeatureClass within a geodatabase. The way I do it is by creating an InsertCursor over an empty FeatureClass and inserting new rows while loopinf through the ...
0
votes
1answer
119 views

Arcpy: Geometry object - distanceTo method in a for loop

I'm new to Python so sorry for this maybe trivial question. I have 4 lines and 4 points, which belong together. I want to get the closest distance from point 4 to line 4, point 3 to line 3, ... . I ...
2
votes
2answers
80 views

Update value in one table (feature class) by coping it from another table. The match between table is done on values from another field

I have two tables (actually both are feature classes in filegeodatabase). They pretty much identical except. one is in lat/lon. second one is projected. both have field line_length and objectid. ...