Questions tagged [arcpy]
A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.
10,383
questions
1
vote
3
answers
107
views
Listing feature classes from multiple feature datasets in GDB
I am trying to list all feature classes from multiple datasets with single GDB. I have tried with below code
import arcpy
from arcpy import env
env.workspace = r"C:\GDB\Base.gdb"
fdlist = ...
0
votes
0
answers
45
views
Generating street intersections using ArcPy in ArcGIS Pro
I created a script that generates street intersections using Python for ArcGIS Pro. The script works fine, but I need to clean up the results. Once the script runs, it captures all to and from ...
0
votes
1
answer
33
views
Merge Tool only includes input feature class using ArcPy with ArcGIS Pro
My colleague and I split some work up between us, and I'd like to merge the two sets of feature classes back into one.
Here's the code I'm using to compare the fc's and use them in the merge tool:
...
0
votes
1
answer
99
views
VS Code re-installation: Pylance now complains about arcpy, but intellisense, code completion, and script execution works ok
I was recently victim to this bug where VS Code (Insiders) seems to uninstall itself. After a reinstallation, most of my settings and preferences were retained, but Pylance is now complaining about ...
1
vote
2
answers
217
views
Setting the spatial reference with Create Feature Class using ArcPy
I have the following code that works fine. However when I open in ArcGIS Pro 3.0 the polylines do not show up until I set the map properties to match the shapefile.
spatialRef = arcpy.SpatialReference(...
0
votes
1
answer
92
views
Script won't iterate through text files in folder
Would anyone be able to tell me why the script won't iterate through each text file? The script runs successfully (Python 2.7), but does not populate GasLines_Final polyline feature class with ...
1
vote
1
answer
91
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\...
1
vote
1
answer
70
views
How iterate with cim.featureTable.fieldDescriptions?
I have the next code:
#Importar librerías necesarias
import arcpy
import pandas as pd
#Obtiene el Mapa activo
aprx = arcpy.mp.ArcGISProject("CURRENT")
current_map = aprx.activeMap
...
1
vote
1
answer
42
views
Name output features based on the input parameters with Python
I am working on a script to parse out features in a .gdb and am having troubles getting the correct naming for the output features. Here's the stripped code for reference:
# Set the workspace
env = ...
0
votes
1
answer
56
views
Using ArcPy from ArcGIS Pro to add the same value to all rows in a new field [closed]
I've created a new field called Year and want to add in the same value (e.g. 2017) to all rows. I know I can do this in Field Calculator, but it is part of a bigger process which I'd like to automate.
1
vote
1
answer
41
views
Feed pixel type of tiles into MosaicToNewRaster()
I am automating the creation a mosaic raster dataset from thousands of individual elevation tiles and am tying to extract the pixel type metadata from the input tiles and specify this pixel type in ...
1
vote
1
answer
96
views
Query error cannot concatenate 'str' and 'Result' objects
I wrote a simple script that iterates trough selected polygons and cuts the points of other layers, and export shapes and txt to different folders according to the zones defined by the polygons.
The ...
1
vote
1
answer
69
views
Displaying feature class in scratch geodatabase created by Web Tool in Web Map it was run from
At Sharing ArcGIS Pro Python Script as Web Tool gives Analyze error 00068 Script ... contains broken project data source I learned how to fix my paths, use a scratch geodatabase and employ a Result ...
2
votes
1
answer
289
views
'Point' object has no attribute 'point'
I am working with the below code for ArcGIS and what I am guessing is a simple error I am making. The aim is the find the tangent to the midpoint of several line segments and then plot a line ...
0
votes
1
answer
54
views
Custom Report Print Service ArcGIS Enterprise
I am in the process of building a custom Widget for Printing multiple reports on different layers. This print widget is from a custom print service created in ArcGIS Pro from the Export Web Map and ...
0
votes
1
answer
19
views
Prepare list of fields for arcpy.TransposeFields_management
I want to generate a list of field names to use a input for arcpy.TransposeFields_management.
The list of fields for the transpose needs to be in this format:
in_field="VALUE1 VALUE1;VALUE2 VALUE;...
0
votes
2
answers
64
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 (...
0
votes
0
answers
26
views
ArcPy Script Assistance: Feed ListFeature list into ListField for report?
I am always getting file geodatabases with requests for a spreadsheet list of all features/objects and their fields/data types. I can do these separately using the List functions, but I'm not ...
0
votes
0
answers
36
views
Batch-moving points to new coordinates in ArcGIS Enterprise Geodatebase (ArcPy)
I have a point feature class in ArcGIS Pro that lives in an enterprise geodatabase. Several of these points have imprecise locations. I have a list of more accurate coordinates for these points, and I'...
0
votes
0
answers
78
views
Exception from hresult 0x80040501 Error with .xls files
I used a few ArcPy lines of code to identify some water wells that had incorrect coordinates and then turned them into .xls files. The code worked well, an in short order I had a spreadsheet for each ...
0
votes
1
answer
70
views
Installing Geopandas from within ArcGIS Pro tool script
I'm creating a script to analyse landcover within an AOI which I'll turn into a geoprocessing tool. I want to use the ESA 2022 landcover and download from within the tool using the code provided on ...
0
votes
0
answers
20
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....
0
votes
1
answer
132
views
Sharing ArcGIS Pro Python Script as Web Tool gives Analyze error 00068 Script ... contains broken project data source
I am using this test script as the source for a Python Script Tool that works in ArcGIS Pro 3.0.2 and that I wish to share as a Web Tool to ArcGIS Enterprise 11.
import arcpy
arcpy.env....
0
votes
0
answers
64
views
Managing style file in ArcPy using ArcGIS Pro
I am trying to update a geoprocessing service that was in ArcMap to ArcGIS Pro. The geoprocessing services use a style file for its legend and I want to update certain legends but I have no idea how. ...
3
votes
1
answer
95
views
Renaming group layer using ArcPy with ArcGIS Pro
How do I rename a group layer in ArcGIS Pro using ArcPy?
In ArcMap I can do so thus:
groupLayer = arcpy.mapping.Layer(r"Path to grouplayer.lyr")# empty group layer as template
groupLayer....
1
vote
1
answer
51
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....
0
votes
0
answers
26
views
How to build ArcGIS line buffer based on raster depth value
I want to create a script in Python for ArcGIS that generates a buffer around a line feature, but I want the width to vary depending on the underlying raster layer. Specifically I want to create a ...
0
votes
0
answers
17
views
Update Cursor not deleting all necessary features in AGOL Feature Layer
I have taxlot data stored in AGOL with related tables, and I have a piece of code that finds and deletes records in the related tables that are not related to a record in the taxlot data. This is ...
1
vote
1
answer
76
views
Pass distances to Multiple Ring Buffer in ModelBuilder with ArcGIS Pro
I am attempting to pass 1,400 distance values into the multiple ring buffer tool using a model I created based on the answer to the following question asked 9 years ago regarding this question (ArcMap ...
1
vote
1
answer
164
views
Export map series to PDF, with page name, using ArcPy ArcGIS Pro 2.7.1
I would like to export multiple PDF files from a map series, with page name as a output file.
I used this code:
import arcpy, os, sys
aprx = arcpy.mp.ArcGISProject("CURRENT")
lyt = aprx....
0
votes
0
answers
16
views
Clear features from a featureset using python in WAB?
I have a geoprocessing widget that is consumed within Web App Builder (version 10.8.1).
The tool (written in Python 3) allows a user to draw points on the map, which is then processed when they click ...
1
vote
0
answers
58
views
Cannot Append date field - getting NULL values
I'm working on a standalone script that appends data from a SQL Server table onto an SDE db table. When working directly in ArcGIS Pro - the append works fine, but using a standalone script - dates ...
1
vote
0
answers
83
views
Compact pbf vector tiles back to bundles from exploded vtpk
There is a great method available in ArcGIS Pro (ArcPy) arcpy.management.ExtractPackage to extract vtpk package including exploding bundle files Esri uses to pack standard pbf vector tiles together ...
1
vote
1
answer
39
views
Applying symbology to layers with Python
I'm quite new to Python and so my knowledge is limited, but I'm trying to create a script that changes the symbology of a group of layers within an mxd. the feature classes are saved in a gdb, and ...
0
votes
1
answer
100
views
ArcPy vertices from each polygon and process separately as the input extent of arcpy.EvaluateRules
I used Generate Grid from Area geoprocessing tool to generate a blocklist of polygons. I have the following code for retrieving the vertices from the layer. My goal, to process each feature record ...
0
votes
1
answer
85
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)...
0
votes
0
answers
45
views
Errors in GP Tool when executed within C# application
I have a custom geoprocessing task written for me in python that takes 2 inputs - input_rows.csv and event_rows.csv - and creates a file gdb with a feature class of a join of these 2 tables.
...
2
votes
1
answer
63
views
If lyr.visible = True
In this very simple code, my program keeps failing at line 4, if lyr.visible = True:, yet if I use Print lyr.visible instead, I receive the response "True" or "False" for each ...
0
votes
0
answers
118
views
ArcPy Apply Symbology from Layer is not working in script
I'm trying to apply symbology on all the layers in my TOC that match a certain string. The apply symbology step of the script makes the layers in TOC glitch, which means it gets executed but the ...
0
votes
1
answer
48
views
Accessing feature classes with a geoprocessing webtool
I'm writing a script which takes a user input from the geoprocessing widget (a polygon that the user draws), and queries the intersecting layers using arcpy.SelectByLocation_managment(). The tool then ...
0
votes
2
answers
53
views
Python Toolbox can't match input parameter to dictionary key in dictionary.get() function
I am writing a Python Toolbox for a parcel prioritization tool. My input data (a set of 11 rasters) is organized into a dictionary, raster_dict, where keys are raster names (i.e. 'Important Bird Areas'...
1
vote
1
answer
118
views
Use nested for loop to find all possible combinations of rasters in geodatabase using Python
I have one geodatabase with multiple rasters where the raster name should automatically identify which category a raster belongs to. I want to combine SLR named rasters with SLOSH named rasters. I am ...
0
votes
0
answers
77
views
Add Query Feature Class to ArcMap using ArcPy
Is there any way to add a feature class from a .sqlite database to ArcMap using ArcPy (Python)?
If I drag and drop the feature class from the .sqlite database, ArcMap creates a Query Feature Class, ...
0
votes
1
answer
63
views
trying to use a loop to buffer around multiple feature classes at once (arcgis using arcpy)
I am using ArcPy to work within a geodatabase in ArcGIS Pro. I need to create a buffer around all the feature classes of a certain type listed in a previous line of code. well_path_list lists all the ...
2
votes
1
answer
35
views
Make an Esri shapefile from a numpy array using ArcPy
I have an Esri shapefile that I have dropped duplicates from and turned into a numpy array using the following code:
loc_ID_fld_names = ["LocIDNmbr", "Lat", "Long"]
...
2
votes
2
answers
114
views
Writing point type geometry using ArcPy gives TypeError: expect single error
Through the following script, I want to write a point feature:
import arcpy
coordinates = [(323528, 6293203)]
PATH = r"C:\Test"
SHAPE = "PM.shp"
# Create a feature class with ...
1
vote
2
answers
47
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 - ...
1
vote
0
answers
46
views
List Feature Classes print blank
I will write a script that must iterate through the subfolders in the PPA folder, and to iterate through the subfolders, I need to reset and list workspaces (there are two folders under PPA named ...
0
votes
1
answer
52
views
Cannot open enterprise geodatabase table from workspace
I'm trying to create a REST Flask API to use instead of geoprocessing with the toolbox. Using the ArcGIS Python environment, I was able to make use of the libraries in Flask, but I'm facing a problem ...
0
votes
0
answers
34
views
ArcPy comparing two databases and deleting and appending data from one to another
I currently am working on trying to ingest data from a client into our database. The schemas are almost the same so I want to compare feature class to feature class and want to delete and append the ...