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

learn more… | top users | synonyms (1)

4
votes
1answer
42 views

Writing points to a file

Trying to write the city name and point coords to a file. The following works with a polygon shapefile but not the point shapefile. I know I'm missing something basic. import arcpy # Set up the ...
3
votes
1answer
106 views

Append List not working

Trying to create a list of well counts. In the code below, wellCntList only contains the current county count and not a list of ALL the counts. Sure I'm missing something simple. for cname in ...
2
votes
1answer
37 views

Add shp attribute data to column with python script

If feature column (feature is the name of the column) in table is ferry crossing in the attribute data then I need to add Yes to the Ferry column that I have already added to the table. If the ...
1
vote
2answers
67 views

Column does not exist - python

My goal is to count the number of wells in each county. I've verified the columns are correct as listed in the attribute table. Do I have a typing or formatting error? I wanted to pull county names ...
0
votes
1answer
57 views

Improving processing time of ArcPy script?

Background: I work for an electrical utility, and we have a point feature class called "meters" that contains approximately 35,000 records. These records represent the actual power meter, and contain ...
0
votes
1answer
40 views

replace ü/ ö/ ä / spaces and brackets in Attribute Table [duplicate]

I've got a Polygon Feature Class of communities in switzerland. Unfortunately, the names in the attribute Field "NAME" include spaces, brackets and ä/ ö/ ü characters. For further processing, i need ...
0
votes
2answers
50 views

Assign Mask From Layer in SearchCursor Loop In ArcPy: Error Accessing Environment

I'm trying to run a loop based on a SearchCursor that selects layers from an input polygon and polyline. I want to select a feature from the polygon to use as a mask for running Euclidean Allocation ...
0
votes
1answer
48 views

Using Update Cursor to update all fields in a feature class based upon another feature class

I have perused GIS stack exchange to find an answer, but haven't quite found what I am looking for. Question: I am trying to update all the fields in a feature class based upon field values from ...
1
vote
1answer
34 views

Updating null values in appended feature class

I am creating a customized script tool that first clips out a line feature from one feature class, dissolves the fields of the clipped feature class so that just one feature is in it, appends the ...
3
votes
2answers
44 views

Fetching single value without Cursor in ArcObjects?

I used the below function to get the single value using ArcObjects. private string getApproverAlias(string checklistId, bool isDeleted) { string approverAlias = ""; var masterTable = ...
1
vote
2answers
46 views

IndentationError: expected an indented block

I am getting the IndentationError in arcpy. I understand this is covered elsewhere but none of the tips appear to be working, I cannot figure out the error. Here is my code; def getCoords(self): ...
3
votes
1answer
94 views

Using Update Cursor, populate field

I am trying to write a script where you preemptively select features and then go to the tool which calls for the feature layer and it populates fields based on certain criteria which I will design of ...
1
vote
1answer
41 views

arcpy SearchCursor is creating a comma within a tuple

I am creating a list of tuples of coordinates of a feature class. Feature class is created as such: inFC = arcpy.GetParameterAsText(0) The inFC is a point feature class. I then have the following ...
1
vote
1answer
56 views

Arcpy SearchCursor (arcpy.da) - Assign cursor value to variable [closed]

I am trying to use arcpy.da.SearchCursor to get the values of two field for each reach record in the DISTRICT feature class. I need to assign these values from the table to a two variables varRegion ...
1
vote
1answer
92 views

Trying to increment a field value for only the repeated records in a feature class using Python

NOTE: If you look at the excel tables just above the comment section it will give a clearer picture of what I want to achieve in my code. So the code below works in doing what I want it to do thus ...
1
vote
1answer
83 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 ...
0
votes
1answer
27 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 ...
1
vote
1answer
57 views

Arcpy search cursor and update cursor to write values from table A to table B

I'm a python beginner. I`m working with ArcGIS 10.2.2 and IDLE Python 2.7.5 I have two tables, table A (top) and table B. I need to read the attributes for the A-table fields for the selected ...
3
votes
1answer
60 views

Calculating one cell from dbf table to another cell in same table using ArcPy?

Am absolutely new to python programming for ArcGIS. How do I calculate one cell from one field in DBF table into another cell in another field in same table? Here is what I've got that doesn't ...
4
votes
1answer
61 views

Error saving object from python script using GetParameterAsText

I have a script that takes in a line, and creates a certain polygon based on this. My code obtaining the input information is as follows: inFC = arcpy.GetParameterAsText(0) hasClearway = ...
2
votes
1answer
72 views

Python script outputs polygon feature class with no shape_area or shape_length and therefore doesn't show up in arcmap

I am trying to copy features a number of times based on a numeric field value. The code below works for points when the POINT type is chosen. However, when I switched the feature type to POLYGON it ...
1
vote
1answer
41 views

Convert searchcursor object to variable

(In advance i have to say that i'm a a self instructed greenhorn at python) I've vbeen struggling getting a seemingly simple job done: Using a python script, i would like to read through a table which ...
1
vote
2answers
43 views

Update Cursor keeps Crashing and Skipping

I use a 3rd party software that exports the name of JPEG as I collect points, in this case street signs. I know the names stay static and are all unique but different features may have the same JPEG ...
1
vote
1answer
26 views

Converting tuple into records in blank feature class using ArcPy?

Here is the code block that I am using with ArcGIS 10.2 for Desktop, it all works great except for the bottom part. I am not sure how to turn the tuple into records on a blank feature class. The tuple ...
2
votes
2answers
37 views

Delete records in feature class that have same ID in CSV table using arcpy cursors

So I have a csv table with records that have an ID. I want to find the same IDs in a feature class/shapefile and delete those records in the feature class/shapefile using Python. I've messed with ...
0
votes
1answer
35 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 ...
2
votes
1answer
56 views

Complex polyline traversing with searchcursor

I have a very specific question about searchcursor traversing complex polyline. My setup is: I imported public transport routes as a single polyline with length in meters. Along this polyline I want ...
1
vote
1answer
25 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: ...
0
votes
0answers
34 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 ...
1
vote
0answers
23 views

Trying to automate clip for multiple polygons based on unique field ID? [duplicate]

I have two feature classes, one that contains all counties for 5 states and the other contains 90 polygons I need clipped only to their pertaining county boundary, but they overlap/ cross the county ...
0
votes
0answers
19 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
18 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 ...
1
vote
2answers
85 views

Error adding row - sequence size must match size of row

I have this table with one row timestamp_pretty 3.1.2014 9:13 timestamp 1,38874E+12 msgid 3 targetType A mmsi 205533000 lat 53.4346 long ...
0
votes
2answers
28 views

What is wrong with this code? my query is not updated with the new value [closed]

query='"depth">1700 AND "depth"<1750' with arcpy.da.UpdateCursor(out_layer,"depth",query)as cursor: for row in cursor: row[0]=0 cursor.updateRow(row)
1
vote
1answer
29 views

Fill a field according to the value of an other field with Arcpy

I am very ill at ease with Python. I am working on ArcGIS 10.3. I am working on a table in a gdb. I want to fill an empty field of this table with an expression (words) according to the value of a ...
0
votes
1answer
73 views

Writing shapefile field values to txt file using SearchCursor? [closed]

I'm having trouble finding a way to write the output of a SearchCursor function to a txt. file. I can print it just fine in a format that is desirable. I just don't know how to get from there to a ...
1
vote
2answers
85 views

Replicating Summary Statistics tool with case field using own calculation within ModelBuilder?

I thought this would be a simple problem to solve, by my googling hasn't provided the answers so far. I have created a near table (Using the 'Generate Near Table' in Arc) comparing two sets of ...
0
votes
0answers
37 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 ...
1
vote
2answers
42 views

Passing value from GetParameterAsText to row.getValue()?

I am trying to build a simple tool that concatenate values from two fields, and recording it in newly created field - everything within the same table. This tool should work with any shapefile, ...
2
votes
1answer
67 views

Print rasters count in Python

I'm trying to print raster batch count number in PyScripter and ArcGIS 10.3 I'm using the next code: import arcpy carpeta = arcpy.env.workspace = r"C:\Base_de_datos\Cuencas_raster" for raster in ...
5
votes
1answer
95 views

need to find max value among fields AND PRINT FIELD NAME

I have a Census dataset that contains eight fields with percentages. I would like a python script that finds the highest value between the eight fields, but also tells me which field the highest ...
1
vote
1answer
72 views

Looping through records to create ArcGIS reports

I am using ArcGIS 10.1 Standard with Python 2.7. I am trying to loop through records in a feature class using a Search cursor and for each record, run a custom ArcGIS report. I have created the report ...
1
vote
1answer
21 views

Create Separate Layers by Category

I'm trying to create a layer for each county (based on a layer of all counties) and join only those census tracts located in that county. However, the result I'm getting is a layer named for each ...
0
votes
1answer
97 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 ...
1
vote
1answer
63 views

arcpy and ArcGIS Pro: update Z values of a pointMZ geometry

I am trying to "reverse" the values of Z in a pointMZ geometry with arcpy.da.UpdateCursor. Anyway, I am not able to find a way to achieve this, although my script seems to work (no errors, printing ...
0
votes
2answers
55 views

How to get the specified point coordinates of a Polyline

lines_cursor = arcpy.da.UpdateCursor(lines,["From_id","To_id","SHAPE@"]) for lines_row in lines_cursor: from_id = lines_row[0] to_id = lines_row[1] if from_id in points_dict.keys(): ...
2
votes
1answer
51 views

Trying to understand updateCursor() for python

I am using ArcMap 10.2.2. I am attempting to write a script that will cycle through the classes in a database and change the attribution of 1 row. Is my variable "lyr" being recognized as the classes ...
1
vote
1answer
230 views

Increase python script speed [closed]

for row1 in cursor1: if row1[0] != None: num3=row1[0].upper() custx=row1[4] custy=row1[5] num2=row1[8] try: ...
0
votes
1answer
20 views

Divide broken line layer in seperate clusters based on location

Building on a earlier asked question on this forum I would like to ask an additional question in getting the task done I asked here: Divide polyline layer in clusters with specific requirements in ...
1
vote
0answers
226 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 ...