All Questions
Tagged with insertcursor or cursor
1,050 questions
0
votes
0
answers
83
views
How to edit attribute with my result from the count
I need this to loop through all the OBJECTID for the Fitting layer. Then it get the count for every line feature touching it. Now I'm at the point where I need the attribute table to be edited with ...
0
votes
1
answer
156
views
Using searchCursor to add to a File Geodatabase Table
I'm trying to add some raster data to a File Geodatabase Table and export it to an excel file. The problem is that it wont print it to the file automatically, I have to create the file first by ...
0
votes
0
answers
42
views
Selecting features from another shapefile using ArcPy cursors and SelectLayerByLocation?
Having the code below im trying to select all the table features from an school_enroll.shp that are within each bigger zones from the hs_bndy.shpwhen i use the arcpy.SelectLayerByLocation_management ...
0
votes
0
answers
209
views
Running out of memory with arcpy.da.UpdateCursor()?
Could anyone let me know if they see why this would cause a memory issue? The user running the script let me know he got a message that he ran out of memory while the script was running.
EDIT: ...
0
votes
1
answer
160
views
Search a certain value in a cursor in multiple fields
I am trying to find the phrase REQUIRE!!! in certain fields (PROJ_NAME, MAJOR_LITH, OWNER_ID) in a feature class. If it has the value REQUIRE!!! it will send user an email. If there are no value that ...
0
votes
1
answer
358
views
Running parallel search cursors in Python?
I have a multipoint feature class and a polyline feature class (transects) filled with the same number of objects. Basically, each set of points corresponds to a single transect.
I want to run the ...
0
votes
2
answers
124
views
How to release last row of recycling cursor
I have a recycling cursor which returns a bunch of features from a featureClass:
while((feature = cursor.NextFeature) != null)
{
// do something with the feature
}
As ArcGIS will use the same ...
0
votes
1
answer
1k
views
Performing multiple if statements with ArcPy UpdateCursor?
Beginner with Python trying to perform multiple calculations on a queried set of rows. I'm am then looping thru a set of queries. But I need to perform all calcuations on returned rows before ...
0
votes
3
answers
388
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
0
answers
320
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
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
0
answers
52
views
Create individual feature classes for every record in a single feature class [duplicate]
I have arc desktop 10.3. I have a feature class (nycd) with 59 records in it. I'm trying to create a simple map with an inset that shows where each community district is located in that borough. I'd ...
0
votes
1
answer
2k
views
Find and Replace python script to replaces values in attribute table? [duplicate]
I am working on a stand alone script in python that will allow to me to specify a shapefile and being able to find a value and replace it with a new value. Does anyone know what code will allow me to ...
0
votes
1
answer
160
views
update cursor datetime if start date greater end date
I have 2 date fields in my feature class. If the start date is greater than the end date, I want to add 24 hours to the end date. I am getting a SetValue error.
cursor = arcpy.UpdateCursor("PolyFc")
...
0
votes
0
answers
36
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
1
answer
903
views
Sorting an UpdateCursor [duplicate]
I'm trying to sort a dataset by field StartTime (datatype date, indicates when a technician is supposed to start a visit). I am including a SQL where_clause to avoid an earlier problem when it ...
0
votes
0
answers
424
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
1
answer
100
views
Selecting/creating polygons of interest based on existing polygon database and indicate other polygons that share boundaries in ArcGIS for Desktop?
I am using ArcGIS 10.2 for Desktop.
The existing polygon database contains attribute table with the following structure, and has three levels; country, state, and city. I am interested in the state ...
0
votes
1
answer
114
views
All rows are being overwritten with last features value using arcpy.da.UpdateCursor
I am trying to populate fields based on objects. When trying to use Update Cursor it overwrites all of the row values with information from the last feature read. I am sure that I am meant to get it ...
0
votes
1
answer
159
views
Updating 3 million rows in file geodatabase
I have a GDB which has 3 million annotation data, then I would like to modify some filed values based on csv table
I'm using the following ArcPy scripts now, but it's too slow
import arcpy
import ...
-1
votes
1
answer
178
views
ArcPy UpdateCursor fails when adding a transform to SHAPE@XY due to type error
I have a Feature class with 285k point features. I am running this code on it:
with arcpy.da.UpdateCursor(FeatClass, ["SHAPE@XY"]) as cursor:
for row in cursor:
cursor.updateRow([[row[0][...
-1
votes
1
answer
2k
views
Working with Area and Length in ArcPy?
I'm currently working on my code, and I have to basically create two new fields in a shapefile (area and length). Then, it requires me to calculate the area and length using Arcpy.UpdateCursor, So far ...
-1
votes
2
answers
51
views
Query not updated with new value using arcpy.da.UpdateCursor()? [closed]
What is wrong with this code?
query='"depth">1700 AND "depth"<1750'
with arcpy.da.UpdateCursor(out_layer,"depth",query)as cursor:
for row in cursor:
row[0]=0
cursor....
-1
votes
1
answer
104
views
Transferring XY coordinates of point from one feature class to point in second feature class using ArcPy
I have a small list of points, testingPoints, that need their geometry (x and y points) transferred to points within a larger dataset, baseCentroids. The datasets share a common field POINTID to help ...
-1
votes
1
answer
762
views
Search Cursor Cannot open Feature Class [closed]
import arcpy
pld3GDB = 'C:\\Users\\bro81520\\Documents\\ArcGIS\\PLDV3_SPC_ODN_315_25Sep.gdb\\PLDV3_SPC_ODN_315_25Sep.gdb\\WO_HIERARCHY'
list = []
fields = ['VENDOR_WO_ID', 'NFID', 'ISFDA']
with ...
-1
votes
1
answer
59
views
Performing field calculation on new field using partial text from existing field via selection using ArcPy?
I am new to python and am having some issues with the following script. I want to select all features that have "State R%" in the field "ROADNAME" and populate another field called "Route" with the ...
-1
votes
1
answer
1k
views
Adding rows and Changing field values with ArcPy update and insert cursor at same time?
I want to figure out how to be able to update my field at the same time as I am adding my new rows into the table. This is just a dbf table not an attribute table.
The attached are my codes, which ...
-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.
...
-1
votes
1
answer
49
views
UpdateCursor increment reference in initial layer with ArcPy dosen't work [duplicate]
I use a function to increment the reference according to a condition I would like to update the reference in the initial table I do it with the following code but the line for the update doesn't seem ...
-1
votes
2
answers
1k
views
Updating Z coordinates of points in polygons with ArcPy
I am trying to update Z values of polygon shape with ArcPy. This script is working without error but increasing the first (0 position vertex) vertex twice. I want to update only once. How can I avoid ...
-1
votes
1
answer
189
views
Using Field Calculator for subtracting values with same ID in ArcPy? [closed]
I have a line shapefile that used for some calculation.
One of the calculation is subtracting values with a same group ID.
The shapefile has a filed called LineID that consists of 2 lines with Side 1 ...
-1
votes
1
answer
151
views
Insert a point into feature class based on another point [arcpy] [closed]
My assignment is to insert (using insertCursor) a new city at 0.02 decimal degrees east and 0.03 decimal degrees south of another city. The cities shapfile did not originally have x-y coordinate ...
-1
votes
1
answer
102
views
More Pythonic way to loop through UpdateCursor?
I have several sets of fields to populate based on other fields. The code below works, but I am wondering if there is a more Pythonic way to march through the i,j pairs? (Actual fieldnames are not ...
-1
votes
1
answer
1k
views
Reading Text File to create Polyline with ArcPy?
This is carrying forward from the previously asked Creating Polyline shapefile from text file using ArcPy?
With further insight from a colleague, I have the following code that I feel is a good ...
-1
votes
1
answer
74
views
Finding difference between populations from 1990 to 2010 and writing info to new field using ArcPy? [closed]
I am trying to write a script that finds difference but every time I use the information from instructor, I am getting an error, and getting nowhere...
table: field one is: Area_name, field two is ...
-1
votes
1
answer
159
views
SQL query new feature within definition within loop of cursor
I am using ArcGIS 10.4.1.5686 and running code within ArcMap. I thought that this question is similar to SQL query new feature with loop, or even Using a for loop to execute a query in arcpy, but ...
-1
votes
2
answers
2k
views
Counting number of instances of certain field value using ArcPy?
I am creating code that accesses a shapefile named Schools.shp. I data I am trying to locate is the attribute field named FACILITIES. Within the FACILITIES field I am trying to get values that the ...
-1
votes
1
answer
81
views
Update field based on array? [closed]
I have created an array using this
import itertools
print list(itertools.permutations('123', 3))
this gives the result of
[('1', '2', '3'), ('1', '3', '2'), ('2', '1', '3'), ('2', '3', '1'), ('3',...
-1
votes
1
answer
87
views
Exporting maps to pdf
I need to create a PDF book of all counties in a counties shapefile.
I now have to use a cursor and a for loop to get individual counties, but I'm not sure how to go from there.
I'm not allowed to ...
-1
votes
1
answer
761
views
Using arcpy.da.SearchCursor to obtain values from field that correlates with "year" field?
I am very new to coding.
I am attempting to use SearchCursor to go through the attribute table of a feature class and return a list of unique years from the years field (which I have done). I am ...
-1
votes
1
answer
388
views
Counting non-null attributes using ArcGIS Field Calculator?
I have an ESRI featureclass with a lot of records that have been scored to certain criteria, although criteria have been left null for records where they aren't deemed relevant.
I'm now trying to ...
-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 ...
-2
votes
1
answer
177
views
SQL statement (where_clause) does not work for UpdateCursor syntax but same works for SearchCursor syntax
feature class fc1 (daily data) and feature class fc2 (geodatabase) both have unique_id field which will be used to map Col1 rows in fc1 to update corresponding Col2 rows (not all rows) in fc2. Below ...
-2
votes
1
answer
104
views
Calculating total numbers of wells that fall into each county of table using ArcPy?
Directions:
For each county calculate the total numbers of wells that fall into that county, and update the county table with the total count. This is the code I have so far.
Problems:
The ...
-2
votes
1
answer
983
views
Search Cursor to count not null values records?
I am trying to achieve print all featureclass, total count, notNullvalues. I am trying hard on this code.
but getting Error:
suggest how can I code better and working. I am not regular python user.
...
-2
votes
1
answer
126
views
Printing rows from table but getting error? [closed]
Here is my code. I have no problem printing out one column from a a table but can't seem to get it right in printing two.
fc = "C:\Users\Brett\Desktop\lesson_5\Lesson5_Data\Lesson5_Data\COUNTIES.shp"
...
-2
votes
3
answers
4k
views
Using arcpy.da.UpdateCursor and if/else statement?
I have been working on this code for awhile and I can't make it work the way I need it to. The code is suppose to move a feature according to a set distance from types in a designated field. As the ...
-2
votes
1
answer
107
views
Time difference between two string fields with microsecond (or seconds) resolution using, Arcpy, datatime and UpdateCursor
I am trying to calculate (using Arcpy) the time difference between two fields that are in string data type and they have the following time format "YYY-MM-DD HH:mm:SS.sss"
I have achieved ...
-2
votes
1
answer
478
views
Stratified random point sampling in Python
I have a very basic knowledge in Python and arcpy. I want to create a stratified random sampling point on a continuous polygon. So far, I have dissolved the polygon (according to categories) and ...
-2
votes
1
answer
227
views
Update Cursor ArcPy based on a separate feature class [closed]
I am building a script that appends features from one layer to another however some of the fields that I need populated are not titled the same which causes them to stay null. How can I set the row in ...