All Questions
62 questions
2
votes
1
answer
407
views
RunTimeError w/ for row in cursor
Every time I execute this, I get a runtime error pointing to my "for row in cursor," stating that A column was specified that does not exist. Any ideas how to fix this?
import arcpy
import os
gdb = ...
1
vote
1
answer
48
views
Framing argument for insert cursor when writing geometries using ArcPy?
I am writing polygon geometries and I have points holding the geometries that represent vertices of the polygon.
When I run the code below I get:
TypeError: sequence size must match size of the ...
1
vote
1
answer
52
views
Extracting field value from Info table( .info ) in ArcGIS
I am working on a Python snippet try to use arcpy.da.SearchCursor() to extract value of certain field from a Info Table which generated by executing arcpy.Statistics_analysis().Here's my code:
arcpy....
1
vote
1
answer
203
views
Detecting failure of Data Access Insert Cursor?
I have data that I have now determined is failing because the underlying Oracle table has a unique constraint that fails. When a duplicate row is inserted there are no exceptions thrown - no way ...
2
votes
1
answer
811
views
Cursor to update feature class by location?
I am trying to update an existing field in a polygon fc with an existing field in a point fc. There is only ever one point fc located within each polygon fc. The field names in the polygon fc can not ...
0
votes
2
answers
234
views
UpdateCursor only updating last row [closed]
I am working with ArcMap 10.2. In the following code, I have a function, build_dictionary, that builds a dictionary that will be used to populate a field within another layer. With the second function,...
1
vote
0
answers
635
views
Update multiple rows in a cursor - Arcpy
I will try explain my code in a simpler way, because it is Portuguese.
I've been trying do make a Python Toolbox in order to select "sectors" of lines separated for some kind of points. For example, ...
1
vote
2
answers
540
views
Using InsertCursor in ModelBuilder?
I've created a function in my model to insert row in a table I've created. The problem is if it runs the InsertCursor function before the end of my program. My model executes incorrectly. I believe it'...
0
votes
2
answers
214
views
How to insert a single point feature into a shapefile?
I have the following problem. I am doing an analysis which creates a shapefile "A" with one or more point features. In the next step I need to insert the individual point features of the shapefile "A" ...
4
votes
2
answers
813
views
Arcpy Insert.da.Cursor - Issues writing polygon geometry
Currently building a tool that automates the creation of some polygons that we need done quarterly. Below is just a set script I am using that is giving me a similar issue when I try to run the ...
2
votes
1
answer
797
views
Using update cursor to populate a field based on a Date field in ArcPy
I'm trying to populate a field (Season, "TEXT") in my attribute table with a season code based on a sampling date (FIXDATE, "DATE"). For example sample collected between 01/01/2016 and 01/03/2016 ...
3
votes
1
answer
6k
views
Creating tables on ArcGIS with arcpy?
I'm using python scripts on ArcGIS 10.2 to read excel files with information and put this results on attribute tables of the ArcGIS.
I know how to create a table, add rows, add fields and send ...
4
votes
1
answer
2k
views
Using wildcard for field names of ArcPy Search Cursor?
How would you wildcard the field_names for a SearchCursor so that it only searched through rows for columns in a table that begin with the word "Layer"? For example:
FCList = []
FCS = [u'Building', u'...
1
vote
1
answer
347
views
UpdateCursor: Invalid input value for setting
I have a field called "CODE_12" in which the values are strings (3 characters). I have another empty field called "AE" and that I want to fill depending on the value on the "CODE_12" field. For ...
1
vote
2
answers
170
views
Removing duplicate pairs in Near Table
Generate Near Table or Near can be used on a single Feature Class to find the nearest feature to each feature.
arcpy.GenerateNearTable_analysis(featureClass, featureClass, pairsTable)
This results ...
3
votes
0
answers
1k
views
Pycharm cannot find reference 'SearchCursor' in 'arcpy.da' [duplicate]
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
1
answer
2k
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....
3
votes
1
answer
4k
views
arcpy.da.SearchCursor accessing 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 ...
1
vote
1
answer
371
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
2
answers
435
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 ...
1
vote
1
answer
420
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 ...
1
vote
0
answers
61
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 (...
1
vote
2
answers
289
views
Grabbing value from field and input into SearchCursor then selecting results for further analysis in ArcPy?
The data:
PL_Fac -point file - facilities used in service area analysis - contains PNTID in Add_PNTID field
PD - polygon - catchment areas assigned to a facility (there can be many polygons assigned ...
4
votes
1
answer
479
views
How to slice a list based on row values? [closed]
I'm working with python 2.7 (quite a beginner).
I have a list, and I have a feature class with :
A = a field that contains values that I would like to use as the start of the slicing
B= a field that ...
2
votes
2
answers
1k
views
Updating firstPoint and lastPoint using ArcPy cursor?
I want to update a Line feature's start and end.
I got Point of first and last.
BUt, I can't update them.
What is wrong ?
(I'm using ArcGIS 10.2)
rows = arcpy.UpdateCursor(srcFile)
feat = row....
0
votes
1
answer
289
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 ...
3
votes
1
answer
117
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 work:...
1
vote
2
answers
838
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
1
answer
958
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 txt....
2
votes
1
answer
67
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 ...
0
votes
1
answer
50
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: Dividing polyline layer in clusters with specific requirements in ...
0
votes
2
answers
543
views
Selecting max(cursor) Value returns incorrect max from arcpy.da.UpdateCursor
I'm working through some da.UpdateCursor scripts to make updates to a fgdb. Although the script below works successfully as a rule, it returns the incorrect max value from one feature class.
The ...
1
vote
2
answers
87
views
Updating field in feature class with Search and Update Cursor:Stop Iteration error
I would like to update a field in a single feature class by a.) searching for a field where the values are not blank and b.) searching for a field where the values are blank.
A typical scenario of ...
1
vote
2
answers
1k
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 ...
1
vote
1
answer
3k
views
Using arcpy.da.UpdateCursor with dictionary?
I'm working through some da.UpdateCursor scripts to make updates to a fgdb. Although the script below works successfully, I want to use the dictionary that I have created rather than the manual [ ] ...
1
vote
2
answers
262
views
Creating a value-counting table with search- and update cursor
I'm a python beginner.
I`m working with ArcGIS 10.2.2 and IDLE Python 2.7.5
I have a shapefile with around 20 fields, each attribute has a value between -3 and 3.
This would look like this:
I ...
-2
votes
1
answer
304
views
Python script with ArcPy cursors won't stop looping?
I am running my script in ArcGIS 10.2 for Desktop and it doesn't stop processing. The process is overwriting itself because I have to shut down ArcMap manually. How can I stop the overwriting as its ...
-1
votes
1
answer
174
views
searchcursor only takes first value in field
My script ArcGIS 10.2 is using the searchcursor to read the mLanduse feature class to return the value in lField, but it is only returning the first value in lField to populate the sField in mSoils.
...
2
votes
1
answer
2k
views
Spatially Joining Many Shapefiles. Use Spatial Join or UpdateCursor?
I have a large number of tree records in 100s of point shapefiles. Each shapefile contains a number of trees that fall within 10-50 parcels. The parcel layer contains ~60,000 shapes. For each point ...
0
votes
4
answers
1k
views
arcpy search cursor not working
Im running my script in ArcGIS 10.2 and the dialog window says completed, but the empty fields in the 'SoilsType' row of the 'mSoils' Feature Class aren't getting populated with the values from the '...
5
votes
4
answers
7k
views
Getting values of last row in table with ArcPy/SearchCursor?
I would like to base my query on the last row of a table? I know the basic syntax/functionality for my search cursor, how do I query only the last row;
Below is an example of my search criteria, ...
4
votes
1
answer
1k
views
Arcpy.da.UpdateCursor, Error - Sequence size must match size of row
I am trying to use an UpdateCursor fill in a field but I keep getting an error, can anyone tell me what I am doing wrong? My code is below:
import arcpy
fc= "C:\Users\Keri\Desktop\GEP_690\Project ...
1
vote
1
answer
233
views
Selecting first 5 rows of selection after reverse sorting using attribute field in ArcPy? [closed]
I have a feature class containing 380 polygons representing sedimentary basins and another polygon feature class representing oil discoveries within said basins. My plan is to:
Iterate through all ...
0
votes
3
answers
1k
views
SearchCursor Index Out of Range
I'm using ArcGIS 10.2 and trying to obtain values in a field using SearchCursor. Would someone help me with this?
import arcpy
oc = r"C:\Users\Scratch\oc.shp"
catchments = arcpy.da.SearchCursor(oc,...
0
votes
1
answer
602
views
Finding duplicate values that ALL share same attributes?
I am using Arcgis Desktop 10.2. Using python script i am trying to resolve the following :
I have 2 columns of data, one containing alphanumeric values, the other some strings like "-1", "-2", "-3" ...
0
votes
4
answers
336
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 ...
2
votes
2
answers
3k
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 ...
2
votes
1
answer
1k
views
Using 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
1
answer
232
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 ...
1
vote
2
answers
1k
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
(x86)\...