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

learn more… | top users | synonyms (2)

0
votes
1answer
15 views

Script with searchCursor crashing arcmap

I was trying to make a script that counts the max lenght found in each field of a table with data in it, but it immediately crashes arcmap upon executing I know there might be a tool available on the ...
0
votes
1answer
26 views

UpdateCursor not filling correctly with conditional statement

I am attempting to update a table so that a field, "ALLREADY", fills with "Y" or "N" depending upon if "dmready" equals "total_records" AND if "dm_stat" is equal to "Ready for DM". When I run my ...
0
votes
0answers
25 views

Using UpdateCursor to populate new field based on conditional statement not updating field [on hold]

I am attempting to populate a new field with a "Y" or "N" based on whether two integer fields are equal. My code seems like it should work, but when I run it, it does not update the field (the field ...
0
votes
0answers
14 views

How to concatenate column attributes into a single column where we don’t know the number of columns or the names via arcpy? [on hold]

I have lots shapefiles all with different columns except for a standard ‘name’ columns. Since the other columns are all different, I want to dump them into one large text column. It would be nice to ...
1
vote
2answers
55 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 ...
0
votes
1answer
37 views

Combining two search cursors (one for table and other for feature class)?

I have a problem from combining two search cursors (one for a table and other for a feature class), there are missed records in the first table, that have not been considered by the first search ...
1
vote
2answers
27 views

TypeError: list indices must be integers, not str when trying to calculate new records in several fields

I am trying to calculate new records in several fields by looping through each field in a list and dividing the value of each record by its shape area. My code is as follows: inFeature = outFeature ...
-2
votes
1answer
36 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" ...
0
votes
1answer
63 views

Calculating well densities in selected counties using ArcPy?

I'm new in python and I have no clue how to do this. I am trying to calculate: total numbers of wells that fall into each county in a shape file, and update the county table with the total count. ...
3
votes
1answer
31 views

ArcPy UpdateCursor appears to not Update field in open Attribute Table?

I have been trying to get Update Cursor to update a field in my attribute tale. import arcpy fields = ['STATE_ABBR','Last_Update'] fc = "C:\Users\sword\Desktop\GIS Web Course\PersonalProject\...
1
vote
2answers
89 views

Using 2 with statements with arcpy da search cursor

I often see code that is comparing 2 shapefiles where there needs to be 2 with statements in the same loop. In my head I always thought both with statements should be placed first before starting ...
5
votes
1answer
71 views

Update from/to Z from attributes using arcpy Update Cursor

Trying to update Z values onto some point and line features from the level attributes on each feature. My script works fine on points - the previous Z values of 0 now have the same values as the ...
2
votes
0answers
38 views

Using Arcpy.UpdateCursor to delete adjacency rows based on a group ID

I have this sample file shown in the picture 1 below. it is a sample data set of a phone survey of drivers. I am trying to find out when those drivers started to drive. My main goal is to build a ...
0
votes
1answer
13 views

Using cursors to summarize per group

I want to summarize fields per Group with python and need help to get unstuck. I'm trying to get the code below to produce a Dictionary of Groups and their total shape areas, like {'Group1':123456, '...
1
vote
0answers
39 views

Calculating polygon width ArcGIS 10.4

I am trying to calculate an average width of a large set of polygons. I found the script below researching the topic. The function is: def add_average_width(featureClass, averageWidthField='Width'): ...
0
votes
0answers
41 views

postgis iterate over rows (cursors)

I need to repeat the same set of operations for each road polygon by using an id (road_id): I have tested my code only on one polygon of geometry using a series of functions inside a WITH query: ...
0
votes
1answer
33 views

Can't get new rows added with Arcpy / InsertCursor

I'm not getting any errors but can't seem to get these rows added. Everything else in the script works fine. I only dabble with Python occasionally so please forgive me for missing anything obvious ...
1
vote
1answer
148 views

Arcpy.da.SearchCursor() help when attribute doesn't exist

I'm updating text elements off of an arcpy.da.SearchCursor script and needed to construct the script to return a response for when the attribute does NOT exist. Here is the snippet of the code THAT ...
0
votes
1answer
39 views

Finding field with maximum value and field name using ArcPy cursor?

I was wondering if an equivalent of summary statistics exists for finding such statistics across fields rather than records in a table. For example, of several fields, I wanted to find which one has ...
0
votes
2answers
70 views

Creating a dict with Search Cursor

I need to find how many routes are assigned to each account number in a feature class. I'm using search cursor twice, first to build a set of account numbers, second to get the number of times a route ...
1
vote
4answers
61 views

Iterate through a list to use then use SearchCursor to populate new list

I have a featureclass of buildings. Each one has a unique number ("BO_UNIQ"). I create a list of these unique numbers (1251 elements). I then want to iterate though this list and get facility names ...
1
vote
0answers
44 views

Pycharm cannot find reference 'SearchCursor' in 'arcpy.da'

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 ...
2
votes
1answer
27 views

moving the objects in a feature class by a field within the table of that feature class

I have a feature class and I want to move its objects based on two fields in it I used the following code but get error: with arcpy.da.UpdateCursor(fc2,["SHAPE@XY","centerpo_4","centerpo_5"]) as ...
0
votes
3answers
99 views

Use if statement to delete row data, ArcGIS 10.3.1, Python 2.7

I have a indoor positioning shp file. I need to do the data cleaning for the further analysis. and here is the attribute table: Field(Sheet1_minor) is the name of beacon, and Fields(Beacon_41_B1,B2,...
2
votes
1answer
30 views

Adding values from list into Attribute with UpdateCursor?

I have a list of values of buildings total height and want to update the corresponding field in the shapefile. fclass is my shapefile totalh is the field which i want to update totaheight is a list ...
2
votes
1answer
68 views

ArcPy Insert cursor losing vertices when writing Polygon features?

I'm currently trying to code a geodesic buffer from points (the one that is implemented in ArcGIS is very slow). The idea is to calculate 100 point coordinates (P_Buffer) around an initial point (P) ...
0
votes
1answer
35 views

Holding onto row values while using cursors

I'd like to be able to use an update cursor to go through rows in a table, holding onto the previous rows value, and comparing it to the current row value, to populate a new field with this value. ...
0
votes
1answer
70 views

Using arcpy.SearchCursor() for multivalue field?

I need to make a multivalue field to be selected as:   Input_Features = arcpy.GetParameterAsText (0) Num_Pop = arcpy.GetParameterAsText (1) #(It contains population data for the periods 2020, 2025, ...
0
votes
1answer
51 views

Which is the faster way to copy data to another feature class: Feature Class to Feature Class or Insert Cursor

I have a feature class with 1 million records. Which is the faster way to copy data to another feature class: Feature Class to Feature Class or Insert Cursor?
1
vote
1answer
49 views

ArcGIS ArcPy update attachments table rows

Some background: We were using Collector on Android to collect data for a layer, and we found out that the pictures that were attached contained no EXIF tags at all, including the orientation tag - ...
0
votes
0answers
23 views

Not able to apply update cursor on OS MasterMap feature classes created using OS Translator II

I am using OS Translator tool to convert OSMasterMap GZ files to PostgreSQL database. The feature classes created are query layers and cannot be edited in ArcGIS. Now I am writing a code to add new ...
1
vote
1answer
102 views

error trying to create two variables Cannot acquire a lock

I am trying to create two variables one for x vertices and another for y vertices, when I leave the vertices as x, y the code runs but not when I separate the vertices into verticeX & verticeY ...
1
vote
3answers
71 views

Using arcpy.SearchCursor SQL clause?

I got a table with the name Predios like this: OBJECTID PRM_IDENTIFICA 1 4030200606130 2 403020060615 3 40302006011700 Can I use search cursor to find the records ...
0
votes
1answer
61 views

Python Script to update all feature classes/datasets in gdb with search and update cursor?

I have two geodatabases, one is a production sde database, the other is a backup in a local file geodatabase. The script runs as a task once a month and is very resource intensive. I am using ArcGIS ...
3
votes
1answer
67 views

How to use search cursor in a given extent

I want to perform a selective search cursor for a feature class for a given extent. I have tried setting env.extent in the below code but it is returning the whole feature class instead of a fixed ...
2
votes
1answer
68 views

Implementing UpdateCursor?

I previously asked Updating attribute information about this script last week. I have amended it and am confused. I need to write the ADMINAREA value to the empty LOCALITY fields from TWB_Suburbs to ...
1
vote
0answers
24 views

Creating new feature class in ArcPy gives error 000210? [closed]

I am trying to create a new attribute table and I keep getting the same error. import os import arcpy import math folderpath = 'C:\Users\Michaelf\Desktop\GEOG M173' arcpy.env.workspace = folderpath ...
1
vote
1answer
68 views

Arcpy update cursor: stop iteration error

I have 1 csv with municipalities and their corresponding zip codes and a GDB of houses which contain address, municipality but no zip codes Objective: add the zip codes to the GDB table import csv ...
3
votes
1answer
80 views

Updating attribute information

I need to write a script that updates the "LOCALITY" field in a feature class if it is empty with the suburb it is in. I have identified the number of properties with select by location and the ...
2
votes
1answer
32 views

Script Tool Automation of Search and Update Cursor?

I keep recieving the following error: RuntimeError: An invalid SQL statement was used. [SELECT [ID_NUMBER,COLLECTION,COLLECTED_,COLLECTI_1], OBJECTID FROM OFFICIAL_STRUCTURES2015] import arcpy as ...
1
vote
1answer
29 views

Arcpy: Insert a text if filed is empty

I want to run a python code that, if 4 fields are empty, insert in the first of them a text. The fields are all designed to contain text. My code is: import arcpy import xlrd import numpy import ...
0
votes
1answer
58 views

Using InsertCursor and SearchCursor with Nested Loops

I have a script that's parsing through text within each record of a table/field, and inserting those values into field/records of another table. Here's an example of the text being parsed (from "...
1
vote
1answer
59 views

Create points along selected line using arcpy

How to make this script take a list of distances along a selected line and create a point featureclass with points at these distances? import arcpy from arcpy import env import os arcpy.env....
3
votes
2answers
45 views

Search for textbits in QGIS

Is there a way to search for only parts of text in QGIS. Imagine I have a field in my attributetable called myField and I have several entries there, something like This is awesome Even more awesome ...
1
vote
1answer
70 views

Arcpy store field value as variable

I am trying to write a script that will go through a grid layer that has individual 535 grid squares. I want to find a way that will tell me how much gas main is left to be checked in each grid. Any ...
3
votes
2answers
43 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
22 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 ...
1
vote
1answer
34 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
72 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 ...
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 ...