Skip to main content

Questions tagged [cursor]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
45 views

Calculating search cursor/percentage using ArcPy

I work with zoning info and have a series of census blocks that are overlapped by a larger zone. I used the identity tool to split the census blocks so that where they overlap they are separated, ...
carokell's user avatar
0 votes
2 answers
55 views

Keeping curves intact while modifying geometry in an UpdateCursor

I am trying to modify some lines in ArcGIS Pro, shifting the Start vertex to coordinates in a pair of fields in the layer attributes. My arcpy script works... almost. import arcpy aprx = arcpy.mp....
Midavalo's user avatar
  • 29.8k
0 votes
2 answers
42 views

arcpy - Select by Location in an Update Cursor

I have parcels and a buffer around greenways. I'm trying to populate a field in the parcel fc with a '1' if the parcel intersects the buffer. I can get that fine with an update cursor and select ...
JustDeb's user avatar
1 vote
0 answers
25 views

Nested cursors with arcy.da.SearchRelatedRecords

I am trying to use python (arcpy) to filter through some data in my Ancestry-GIS. All inside the same geodatabase I have: A point feature class called places shape | placename | GlobalID | Two non-...
DOMINUS MIHI ADIUTOR's user avatar
2 votes
0 answers
59 views

QGIS is not properly closing some PostgreSQL binary cursor, letting DB transactions with a state "idle in transaction"

In a QGIS 3.34.5-Prizren project having PostgreSQL/PostGIS layers, I can sometimes see such queries for different layers in the "Debugging/Development Tools" tab, under the "Query ...
swiss_knight's user avatar
  • 10.5k
1 vote
0 answers
57 views

How to update the Z value using an UpdateCursor

I'm trying to update the Z value using UpdateCursor, the problem is the update is not working. import arcpy from collections import defaultdict import random from statistics import StatisticsError, ...
sam's user avatar
  • 11
0 votes
0 answers
60 views

My while loop in ArcMap using ArcPy is not giving what I want

I have revised my code I am trying to get cumulative catchments from a table in arcmap using a table, I am using four fields namely CatName(cid), Area(Load) and DS(Downstream Node) , I want the ...
Dingaan Mahlangu's user avatar
0 votes
2 answers
60 views

Selecting records after using insert cursor

Using ArcPy and on the same script, I would like to perform a SelectLayerByAttribute tool to select the features created with the InsertCursor tool. coords = [1, 2, 3, 4] pointlyr = 'point' Sr = ...
user206005's user avatar
0 votes
1 answer
43 views

Search cursor skipping every other row

I am trying accomplish something which should be fairly straight forward. I am trying to merge snowfall events within 4 hours into a single event so. The end of the entire event, and the name of the ...
GouldGIS's user avatar
1 vote
1 answer
72 views

for loop with a cursor only iterating once [closed]

I am running a search cursor with the code below (part of it) and my code is only yielding the first iteration. There isn't any selection on the FC prior. Why is it stopping at the first iteration? ...
user206005's user avatar
1 vote
1 answer
44 views

Select points by polygon and update attribute field

For each record in the pointLayer, I'm trying to see where they are located using the polygonLayer. Then, update this location information to the "SWPsubwatersheds" field from the pointLayer ...
user228948's user avatar
0 votes
1 answer
139 views

Calculating SUM of multiple fields into new field using ArcPy

I have 4 fields (STREAMS, SLOPE_ASPECT, FIRES, TREES) that are assigned either a 1 or a 0 based on whether they exist or not. The goal: Create a new field "ranking" the best locations (...
brokenCloud's user avatar
0 votes
1 answer
43 views

arcpy.da.UpdateCursor() on field values in rows that meet "where_clause"

I'm looking to copy the values from the "Layer" field to the "COMMENTS" field... then change the string value in the "Layer" field to "Fiber Cable". The feature ...
liso_maps's user avatar
  • 103
0 votes
2 answers
80 views

Only want to updated first 26 records in a table using UpdateCursor

I'm trying to updated values for records in an attribute table. All records have a quadrant number (in field "Quadrant") and a random integer (in field "RandomSeg") assigned to ...
JudithM's user avatar
0 votes
0 answers
59 views

Update field using dictionary and list

I have two layers, layer A and layer B. I need to update the SC field on layerA from layerB SC_1 field. I have the following that does a spatial join, then use a Distinct list to populate the SC_1 ...
2Quiker's user avatar
  • 11
0 votes
0 answers
107 views

Getting assettype and assetgroup field values from feature class with domain using ArcPy

I am trying to get the field values of assettype and assetgroup from a feature class but I am not able to get the values there are subtypes assigned to those fields and also values are domain coded ...
Kumar Prince's user avatar
1 vote
1 answer
72 views

Python-code "max value among fields and print field name" working in ArcGIS Pro command line, not in script-tool

I tried this code in ArcGIS Pro. I am getting the code to work great in command line. However, trying to script a tool out it in ArcGIS Pro. Getting an error: File "", line 13, in ...
Stefan Arvidsson's user avatar
1 vote
1 answer
226 views

TypeError: cannot update branch versioned table

I have several editors making edits to a branch versioned, sde referenced layer on ArcGIS Portal. As part of the work flow, I want editors to open their ArcGIS Project saved with their edit version of ...
geoJshaun's user avatar
  • 1,335
0 votes
0 answers
160 views

How use multiprocessing with function arcpy.da.InsertCursor

I'm working with a table in the database that has more than 1 million records and a total load of this table takes about 8 hours because it has geographic data, the table is a featureclass. Basically, ...
Felipe L's user avatar
2 votes
1 answer
93 views

How can I loop through features in layers to create an individual geodesic viewshed raster for each feature?

What I have: 1/3 Arc Second DEM for the extent of my AOI Feature class containing ~16 observers with fields for 'observer_offset,' 'outer_radius,' 'horizontal start angle,' and 'horizontal end angle' ...
Austin Averill's user avatar
0 votes
1 answer
46 views

arcpy.SearchCursor and unexpected results

I'm stuck on results that arcpy.SearchCursor is outputting. I'm accessing a table on a database connection. When I run this, it crashes with an error: argument of type 'Row' is not iterable I ended up ...
vbj4's user avatar
  • 11
2 votes
1 answer
75 views

Shapefile not Z-enabled although the environment is Z-enabled in ArcPy

My attempt is to view raster values in the command window. The follwing code is thought to do this by converting the raster to a point feature file and by successively scanning the values at the ...
stonebe's user avatar
  • 467
2 votes
2 answers
104 views

Update specific row based on string

I'm new to ArcPy. I am attempting to find the string 'Unknown' and update the 'Comments' field, that indicates which field contains the 'Unknown' string for that row. I was attempting to use ...
Trav34's user avatar
  • 21
1 vote
1 answer
36 views

Calculating individual Sum of multiple fields

I am trying to calculate the sum in each field in my list: Cost_Adders = ["RR_CROSSING", "INTERSTATE", "RIVER"] for Cost in Cost_Adders: where = f"Cost_Adders = {...
hBiery's user avatar
  • 13
2 votes
1 answer
104 views

Changing value of layer attribute based on geometrical conditions of line elements through ArcPy in ArcGIS Pro

I have a feature class layer that comprise of line elements. For my purpose, I needed the start and end point coordinates of each line, so I added new columns with add field and use calculate geometry ...
rez's user avatar
  • 202
1 vote
0 answers
27 views

Calculate distanceTo between points consecutively and use an update cursor to fill in a new field in an attribute tablea

I have a shapefile that I need to update with the distance between its points in the order they appear in the attribute table. I've been instructed to do this by using an Update Cursor and the ...
hanbone's user avatar
  • 33
0 votes
1 answer
39 views

How to extract field values from one layer, add them together, and insert them into a field in a nearby layer? [closed]

I'm working with two different point layers (layer1 and layer2). Layer1 will have a field (field1) that contains four possible values (a, b, c, d) and another field (field2) that contains a given ...
Justin's user avatar
  • 1
0 votes
1 answer
111 views

Find duplicates and merge attributes arcpy

I have a point shapefile which has duplicate points based on an "ID". ID1 + permit1 + resources associated to permit ID1 + permit2 + resources associated to permit ID2 + permit1 + resources ...
Katie B.'s user avatar
1 vote
0 answers
113 views

arcpy.da.SearchCursor is skipping rows when selection is "large" [closed]

In ArcMap 10.6.1 I have a script Python (2.7.14) in a simple ArcToolbox that uses an arcpy.da.SearchCursor to iterate through the selected point features (poles) to produce an Excel report. The cursor ...
nanunga's user avatar
  • 533
1 vote
0 answers
65 views

Flip line only on selected rows with arcpy.da.UpdateCursor and calculate new line bearing on it

I'm trying to use arcpy.da.UpdateCursor to flip line only on selected records in shapefile that are greater than value 180. Then I would like to recalculate Line Bearing on the attribute called "...
peter_msd's user avatar
1 vote
1 answer
97 views

Flipping line that touches certain points using ArcPy

I have a layer of points and a layer of lines (shapefiles), that have been split so the lines have 2 vertices. I would require to change the direction of those lines (flip), only if they touch (...
nanunga's user avatar
  • 533
0 votes
1 answer
125 views

Using Search/Update cursors to find the max value in a field and replace negative numbers in same field with max value + 1

I am a bit rusty with Python, I know conceptually what I need to do but am not sure of the syntax/formatting. The table I'm working with has an id field with negative and positive values and null ...
speedwagon's user avatar
0 votes
1 answer
96 views

Using Python dictionary to update street type in another field in ArcGIS Pro

I am using a dictionary to update street type in another field in ArcGIS Pro 3.0.3 I am a novice python user and I am having problems updating a string field with a dictionary. I am joining ...
Warren Navarro's user avatar
0 votes
1 answer
711 views

Use arcpy.da.UpdateCursor in ArcGIS Pro to update a field with a NULL value

I would like to search a specific field within an attribute table in ArcGIS Pro using ArcPy and find all the null values and change the null value to the value above it. For example: ID | field1 | ...
GIS_developer's user avatar
0 votes
0 answers
156 views

Edit attribute tables with another table in ArcGIS Pro using ArcPy

I have two tables and I need to update one based on the other. For this, I need to take two columns (idscap and spardcode) as the initial reference value and thus modify all the columns of the table. ...
Andrea Quintero's user avatar
0 votes
1 answer
75 views

ArcPy SearchCursor : AddMessage with field value

I'm trying to get a message in ArcMap dialox box showing the features IDs that have null value in attributes X, Y, or Z. myFeatureClass ID_FIELD X Y Z 101 140160 350350 450 102 140165 350348 103 ...
Maja's user avatar
  • 33
2 votes
1 answer
119 views

Adding geometry to a db table using ArcPy from an existing points dataset

I am attempting to write an ArcPy script to add the geometries of a points data set to records in a db table. Each record in the db table has a field containing a date, and an associated numeric value ...
TreeGIS's user avatar
  • 126
1 vote
2 answers
724 views

Update cursor not working but with no errors

I want my code to find the maximum value of a field from attribute table and return that as a the value for another field in another attribute table, trying to do this with search cursors and update ...
Chelsea_VictoriaS's user avatar
0 votes
1 answer
144 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 ...
icye's user avatar
  • 9
1 vote
1 answer
153 views

Creating shapefile from text file using ArcPy

Fourth update, per suggestions from comments and professor. Still getting the "takes no arguments" error "Traceback (most recent call last): File "C:\Pythonpro\pythonProject2\...
PieCharmer's user avatar
0 votes
1 answer
65 views

Looking for PyQGIS equivalent of ArcPy "SearchCursor" class [closed]

How can I consult and use shapefile attributes without reflections on the map? Like a 'Search Cursor object' from ArcObjects. Also using a query expression to filter data.
Fernando Tav's user avatar
0 votes
2 answers
164 views

Inserting geometry objects into existing layers with ArcPy

I'm trying to add new features to a layer based on geometries created from a list of WKTs. The code I have so far: Creates a polygon layer and sets the projection (NAD83) Creates a geometry object (...
ArcPie_22's user avatar
0 votes
0 answers
23 views

how to compare all the fields of two feature class with 0 in one file and null value in another file and change it to the same value as of first file

need to search the inputpolygon and checkpolygon and update the value to check polygon with arcpy.da.SearchCursor(Inputpolygon,['market', 'type', 'latitude','postalCode'])as Cursorop: with arcpy.da....
newbiee's user avatar
2 votes
1 answer
244 views

Copy geometry only from one feature class to another based on condition

I'm trying to use ArcPy to copy only the geometry from one feature class to another based on a certain condition. Here is my code so far: source_fields = ['contition_field', 'SHAPE@'] icursor = arcpy....
a_uly0003's user avatar
0 votes
1 answer
336 views

Expected field not found using SearchCursor and SelectLayerByAttribute tools in ArcPy ArcGIS Pro 3.0.0

ArcGIS Pro 3.0.0 - using ArcPy First, I'm very new to coding with Python, so there may be a few mistakes in my code that I am not catching. I'm trying to select each row in a table (line feature class)...
Cass_789's user avatar
1 vote
2 answers
63 views

Using row.setValue in ArcPy with ArcMap [closed]

This is my code: #-*- coding: utf-8 -*- # Import system modules import arcpy import pandas as pd ### ROTINA MÁQUINA INTERNA PERIODICIDADE: 1 DIA ### print ('Script Rotina da Maquina Interna - ...
José Borges's user avatar
1 vote
0 answers
35 views

Updating a field values based off of values in the same column

I am struggling with the concept of this code and am not sure if this is even something I can do. I am using a gdb with a feature dataset and a number of feature classes. I have a feature class "...
Mackenzie Alice's user avatar
0 votes
2 answers
53 views

Deleting geometries in feature layer based on unique field values

I have a building feature layer for a county. Some parcels have more than one building, so the buildings in these parcels all have the same TMS number in the "TMS" field. I only want my ...
jcholly's user avatar
  • 166
1 vote
0 answers
102 views

Cursor script runs but not updating value

I have a script I wrote to use an update cursor to change any records in a feature class that has a field set to 'N' to 'Y'(coded domain values). I have ensured that the database connection file is in ...
Adam's user avatar
  • 11
2 votes
0 answers
80 views

QGIS 3.22.10: problems with cursor, while writing a filter

I just remarked a problem in QGIS 3.22, I never had before. When I write a filter for a layer, then the cursor is several millimeters right of the place where I write. This makes it difficult to write ...
Bertram's user avatar
  • 483

1
2 3 4 5
21