Questions tagged [arcpy]

A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.

Filter by
Sorted by
Tagged with
0 votes
0 answers
85 views

Utilize ArcGIS Python script tool parameters to convert Excel file into a projected featureclass

I am creating a Python script tool in ArcMap to help automate some GIS tasks. The script takes an Excel file( that has Lat/Long fields with values) as the first input parameter. The second parameter ...
1 vote
0 answers
36 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 "...
1 vote
0 answers
46 views

Invalid parameters in arcpy Extract by Mask

I get the following error when I try to extract by mask within a function in my script. When I run the same script separately outside of the function it runs fine. The output is just an intermediate ...
0 votes
0 answers
47 views

Running Python scripts via cronjob using the ArcGIS Python env on Ubuntu 20.04

I am having an issue running any Python scripts via the ArcGIS Server Python Env through cron jobs. I can access and run any script including importing the ArcPy library via the command line as such: /...
  • 597
0 votes
0 answers
31 views

Multiple raster file statistics

This is the code to find the maximum value in multiple raster files. Is there a way to batch run the code? work_dir = r'E:\GEE_processing\VIIRS\test_16dy\data' result = r'E:\GEE_processing\VIIRS\...
0 votes
1 answer
48 views

ArcPy calculating area in att table column in ArcMap - Error 000800: The value is not a member of PYTHON

Attempting to make the following code work in ArcMap: for i in range(len(l)): print("calculating area" + str(i)) in_layer = l[i] exp = "!SHAPE.AREA@ACRES!" arcpy....
0 votes
0 answers
86 views

ArcPy CalculateGeometryAttributes parameters for area calculation - Failed to execute error

I have a large project I am working on and am stumped on one step. There is a large group of layers (over 40), for each of which I need to (1) add an area column to the attribute table and then (2) ...
1 vote
1 answer
53 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 (...
  • 513
0 votes
1 answer
44 views

ArcPy: Grid Index Features freezing and crashing ArcGIS Pro

I am trying to use the grid index features tool in ArcPy. However when I run it outside of the Python window in ArcGIS Pro, it freezes and crashes. When used within ArcGIS Pro it works fine. I am ...
  • 11
0 votes
0 answers
16 views

Print the associated description that belong to a feature class (ArcPy)

My database has multiple feature classes with many associated fields. In the attribute table the attributes are displayed as strings (for example Culvert), but they have associated a code (ex. Culvert ...
0 votes
1 answer
53 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 ...
0 votes
0 answers
50 views

Search Cursor toolbox Error 000601 (Python)

I'm trying to create a toolbox that utilizes a SearchCursor (with ArcGis Pro) to filter a layer with another's attributes. This is my first attempt and I've ran into some errors I don't know how to ...
0 votes
1 answer
36 views

Importing another py file I wrote with Python to addin wizard py file

I'm going to write an add-in module, I made each combobox from a separate py file. And I got the results I wanted. Now I will transfer them to the py file in the toolbox that I created with an ...
0 votes
1 answer
28 views

How to use variables in field calculator using ArcPy

The aim is to perform a multicriteria-analysis in which I use 3 columns in a dataset (dataset) and 3 weight settings, each one relating to one column. A new column (MCA) equals the result of the ...
0 votes
0 answers
33 views

Where is what I'm editing?

I'm trying to find a way to access the path of the notebook file (.ipynb) that I'm currently editing, in a way that would work either in ArcGIS Pro or in an external IDE like Jupyter or VS-code. What ...
0 votes
0 answers
89 views

SQLite database not updating

I have a SpatiaLite database that I need to update from a shapefile. I have successfully created a dictionary querying the shapefile and I've printed on my console statements like: UPDATE POLE SET ...
  • 513
0 votes
1 answer
53 views

List all layers within an .aprx and export all to a .gdb

I would like to export all layers within an .aprx to a .gdb. This is the script: # Set the .aprx file as the workspace aprx = arcpy.mp.ArcGISProject(r"B:\XXX000\XXX35219_BCG\Workspaces\EIAR\...
0 votes
1 answer
35 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 ...
0 votes
1 answer
91 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 | ...
0 votes
0 answers
34 views

Apply the same symbology to multiple raster layer

I have many raster layers and I need to apply same symbology to all raster layer. I used this code and the error was: Runtime error Traceback (most recent call last): File "", line 8, ...
  • 69
0 votes
1 answer
59 views

ArcPy UpdateCursor - Adding different text to more than one row of a shapefile entity

I have the following code, which adds a field, and then a value to a row: import arcpy V1 = r"path/shapefile.shp" # Add CODE field arcpy.AddField_management(V1, "VERTEX", "...
0 votes
2 answers
85 views

Iterate through multiple arrays from several folders and perform calculations

Iterate through multiple arrays, each having multiple arrays I have three folders, each containing 675 NumPy arrays. I want to iterate over each array in each folder. My first folder is “Barleyarea,” ...
0 votes
0 answers
62 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. ...
1 vote
1 answer
28 views

Error (UnicodeDecodeError) in adding field to obtain surface (in hectares) of a shapefile

I have the following script, to calculate the area of a shapefile on a given field in its attribute table. import arcpy shapefile = r"path/shapefile.shp" # Add SUP_HA field arcpy....
1 vote
1 answer
66 views

arcpy.sa.RasterCalculator tells me the input raster is invalid when I use a complicated python expression

Some brief background: I am dealing with a raster band whose data consists of a 16-bit unsigned integer. Each of the bits of this integer conveys separate pieces of information about the quality of ...
0 votes
1 answer
76 views

Calculate area of geometry in hectares using ArcPy

I have the following script, where it adds fields to a shapefile. The fields are a code and "Sup_ha", which is the area in hectares: import arcpy shapefile = "path/shapefile" ...
0 votes
1 answer
54 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 ...
  • 33
0 votes
1 answer
129 views

Cannot overwrite feature class file in gdb while occupied by ArcGIS Pro (Python script and ArcPy package)

I wrote the following piece of code that loops over a map features and buffer them. new buffer layers are saved to a different gdb with in this project. If I run the code from IDLE while that project ...
0 votes
0 answers
25 views

Extract data from user defined polygon and allow user to download as a layout and table/Excel file

A lot of components going into what I am trying to accomplish. I am making a web app where multiple data layers are displayed. I would like to create a geoprocessing tool that allows a user to input ...
  • 1
0 votes
1 answer
57 views

Rotating symbol layers based on attribute values and direction of connected services

I'm working with ArcGIS Utility Network and I would like to rotate my taps to align with the direction of the service lines. Here is an example of what they look like initially: As you can see, the ...
-1 votes
1 answer
51 views

Delete Polygons And Extend Lines in ArcGIS Pro

I am trying to do the same of Delete Polygons And Extend Lines tool, but I don't have because of the licence that I had. It works to extend the line after deleted the polygon in between any 2-3 lines. ...
2 votes
1 answer
56 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 ...
  • 116
1 vote
2 answers
67 views

Adding a layer to multiple maps within the same project with ArcPy [duplicate]

Using ArcGIS Pro 3.0 I am looking to apply a definition query on a feature class from a geodatabase and add it as a layer onto 3 maps. My thought was to use a for loop to loop through my maps and add ...
0 votes
0 answers
34 views

Multiple Ring Buffer returns RuntimeError: ERROR 000824: The tool is not licensed

I'm creating a tool that will be used by the Geoprocessing widget on my organisation's enterprise server. When I attempt to run my tool, I get an exception: ERROR 000824: The tool is not licensed ...
0 votes
1 answer
49 views

Get the path of each row in an attribute table and put it in a path field in the attribute table

How do I create a new field in this attribute table and populate it with the path of each row in the attribute table using PYTHON? I know there is a way to do this in ArcGIS Pro using the "...
1 vote
0 answers
50 views

Dynamic text source is lost when changing map layout in ArcGIS Pro [closed]

I'm trying to make arcpy custom toolbox where one of the tools is to make a Map Layout. I'm using dynamic text to change Map Information based on the feature class. It should be something like this: &...
  • 29
0 votes
0 answers
36 views

Why is my code changing the labeling for my legend?

By default, the legend that is created from a layout includes a label with the field name. However, when I run my Python script to change the symbology of a layer, the label is changed to include the ...
1 vote
2 answers
88 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 ...
0 votes
1 answer
27 views

Using a variable in a SQL expression within Make Feature Layer function

I need to make a function to call in another script to count the buildings within an area using a field value UseCode Here is what I have with my test script. I know the make feature layer is not ...
1 vote
1 answer
75 views

Make XY Event Layer in arcpy using a pandas dataframe

I have a Pandas df with Latitude and Longitude columns I am trying to export to a featureclass using ArcPy. I cannot resolve the fiona and GeoPandas issue so I tried to use MakeXYEventLayer_management ...
  • 1,393
0 votes
0 answers
75 views

ArcGIS Pro - Route Solver Multiprocessing in Standalone Script

I am using ArcGIS Pro 2.9 with an advanced single use license and a local network dataset. I am attempting to write a standalone script that takes as its input an arbitrary set of origin-destination ...
  • 1
0 votes
4 answers
118 views

Verifying if field name in a feature class exists

I need to create a module to call to determine (true/false) if a field name in a feature class exists. My code works fine but returns a true or false for each field name, where I just need one true/...
0 votes
1 answer
114 views

How to select a layer from the current map using Python on ArcGIS Pro?

I'm trying to learn how to use Python notebooks on ArcGIS Pro. I'm trying to add a new field to one of the layers on my Map. I added the layers to my map from online. This is the code I have so far: ...
  • 1
0 votes
0 answers
42 views

Copy feature classes from feature datasets/geodatabases

I have two geodatabases that I would like to 'walk' through. They are contained in a folder. Each feature dataset and feature class within the two gdbs have the same names. What I really want is how ...
0 votes
2 answers
86 views

"ERROR 000732: Input Features Does Not Exist Or Is Not Supported" when attempting MakeFeatureLayer

I am trying to select features by location, but am running into a problem where the input feature class is not being recognized. # Import module import arcpy # Define workspace and overwrite status ...
0 votes
1 answer
72 views

Arcpy.CopyFeatures_management creates empty feature class

I am trying to iteratively copy selection layers to new feature classes. My script successfully creates the new feature classes, but they are empty. Can anyone point out what I'm doing wrong? arcpy....
0 votes
1 answer
78 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 ...
  • 9
0 votes
1 answer
21 views

Using ReplaceDataSource with group layers and ArcPy with ArcMap

I have a script to replace the data source on layer files in an mxd based on a geodatabase input from the user and a feature class with a matching name to the layer. This script works as intended as ...
  • 13
0 votes
2 answers
37 views

ArcSDESQLExecute is not able to handle unique identifiers

Using ArcGIS Pro 2.9.5 I found that ArcSDESQLExecute is not able to handle unique identifiers (UNIQUEIDENTIFIER) a.k.a GUIDS, in a table. I tried to run the following Script: database = 'C:\\...
  • 764
0 votes
2 answers
35 views

ArcPy RemoveLayer doesn't work

I have a task where I have several polygons and I have several data frames in which each has a different temporal image. I have linked the data frames to one main data frame in which I add a polygon ...