Questions tagged [arcpy]
A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.
10,460
questions
0
votes
0
answers
10
views
Select part of a long polyline with ArcPy code
I have a long and complicated polyline (screenshot is showing part of it). Now,I'm trying to find a way to select part of it (cannot be done by simply selecting features dues to the way the polyline ...
0
votes
1
answer
25
views
Getting feature datasets with arcpy.da.Walk
I am using ArcGIS Pro 3.1.0.
I'm trying to find feature datasets in file geodatabase (possibly many geodatabases, but for clarity here only one) using arcpy.da.Walk. I'm aware of workaround using ...
0
votes
1
answer
28
views
Change datatype of range of columns while importing a CSV file
Let's say I have a CSV file that has a bunch of columns, starting from Field1 to Field141. Now all these columns have a text datatype. And I would like to import this CSV in such a way that the ...
0
votes
0
answers
22
views
Dropped fields in edited data
I have very little experience using Python and have spent the better part of today trying to cobble together a script for ArcGIS Pro using AI powered solutions (its all I got!). My dilemma is this:
I ...
1
vote
1
answer
15
views
ArcPy - overwrite feature service with CSV
I am trying to download a CSV from our project database, and then append this to a feature service in AGOL.
import os
import requests
import csv
import arcpy
from requests.auth import HTTPBasicAuth
...
0
votes
0
answers
27
views
Split concatenated attributes into new rows using ArcGIS Pro [closed]
I'm using ArcGIS Pro 3.1.2
I have a table (5000+ records) with an ID field ("IdClient") that stores multiple ID values, using ";" as the concatenation separator and a "Network&...
1
vote
1
answer
24
views
How to filter an entire geodatabase by location using ArcPy [closed]
I have a GDB that has national-scale info, but I only need information from a certain state, to which I have the respective polygon.
Is there a way to automatically:
Iterate through all the feature ...
0
votes
0
answers
23
views
County mean elevation data [closed]
I'm new to ArcGIS Pro and I'm trying to extract the mean elevation data for US counties. I'm using arcpy to get the data using python. I downloaded the shapefile data from USGS and created a feature ...
0
votes
0
answers
26
views
Change latitude (rows) and longitude (columns) in columns using ArcGIS [closed]
I have a data frame as dBase table in ArcGIS where latitude (lat) values are the names of the rows, and longitude (lon) values are the names of the columns, and for each cell of the data frame is a ...
0
votes
1
answer
15
views
Export/print version differences between child version and default version from ArcGIS Pro to an Excel spreadsheet or .csv file
How to export/print version differences between child version and default version from ArcGIS Pro to an Excel spreadsheet or .csv file?
When I have a version other than the default, and click on ...
0
votes
0
answers
29
views
Large polygon with null geometry
I have a flood hazard area polygon that I'm creating based on a depth raster for a HUC 8 watershed. The script tool I use is as follows:
import arcpy, os
arcpy.env.overwriteOutput = True
arcpy.env....
0
votes
0
answers
20
views
Unable to get ArcGIS Pro utility network, Trace Tool output in PyCharm
I am trying to run Trace Tool in PyCharm using ArcPy and get the traced features in PyCharm but after running the Trace tool in PyCharm I am not getting the traced features details.
I am running this ...
1
vote
1
answer
41
views
Iterate through entire database, detect null or 0 values in Shape Area or Shape Length field and report them - ArcPy
I would like some code that goes through a database and reports any and all feature classes that have a 0 or a null value in an shape area or shape length attribute. If it could all get somehow put ...
0
votes
1
answer
31
views
Field mapping with ArcPy
I've joined a point FC (InputPointCopy) with a polyline FC (Polyline) and now I'd like to append the Polyline FC att table to an empty FC of the same geometry.
I ran across a custom function at Using ...
1
vote
0
answers
27
views
Using ArcPy to add a field to an existing file geodatabase feature class
I was using this example to try and add a field to a feature class I created in a fileGDB:
arcpy.management.AddField(in_table, field_name, field_type, {field_precision}, {field_scale}, {field_length}, ...
0
votes
0
answers
18
views
arcpy.management.DeleteField working in Pro notebook but not online hosted notebook
I'm trying to take some models in ArcGIS Pro that I've built, and translate them into a AGOL Advanced notebook. Originally I was building the notebook in Pro for testing. However I just tried it in ...
0
votes
0
answers
13
views
Edit Raster Function not working in MDCS
I have a python script tool that calls a MDCS. For some reason the edit raster function does not work anymore. I can apply it with the GUI tool and it works. I have tested with other TIFs. It actually ...
0
votes
1
answer
28
views
ArcGIS Pro - Raster percentiles
In ArcGIS Pro I have a continuous raster.
I want to calculate an upper and lower percentile value and apply to smooth out the range of values. For example applying the 90th percentile value to the top ...
0
votes
0
answers
28
views
Using pandas with ArcPy, ArcGIS Pro, ArcGIS Portal and Survey123
My organization has a Python script that essentially logs into our organization’s Portal account, reads the data submitted on a corresponding Survey123 form, then creates two output tables summarizing ...
1
vote
3
answers
35
views
Finding the distance along line from beginning to a point using ArcPy
I have a polyline feature class and a point feature class, they are both in the same projection. The points have been snapped to the line and I am attempting to measure the distance along the line ...
0
votes
1
answer
20
views
Intersect a layer with a feature dataset
I would like to perform an intersect of a layer with multiple layers from a feature dataset (it has about 30 layers or so), resulting in 30 different layers as well. I know I can do this as a batch ...
0
votes
0
answers
24
views
Error 00732 dataset does not exist or is not supported
The error below occurs despite being able to hit the rest end of the service in the error.
import arcpy
from arcgis.gis import GIS
import datetime
arcpy.ImportToolbox(r"C:\Users\arcfmun\Downloads\...
2
votes
0
answers
19
views
Combining symbol classes using ArcPy
I'm trying to write a test script which looks at a layers attributes and then applies different colours based on a given attribute. This is the script I have so far:
import arcpy
aprx = arcpy.mp....
1
vote
0
answers
31
views
ArcPy add XY points and buffer
I've got some ArcPy code below which adds all the CSVs in a folder, adds them to the map (AddXYTableToPoint) and buffers the points.
I'm running in a Python notebook in ArcGIS Pro I only want to add ...
1
vote
1
answer
52
views
Converting Esri Grid format (adf files) to GeoTIFF using Python and ArcPy
In ArcGIS Pro, I am attempting to convert and export Esri Grid Format (ADF) files that are rasters to TIFF files. I want to be able to do this in Python using ArcPy. However, when I attempt to use the ...
0
votes
1
answer
27
views
Avoid reimporting data to a map as more data gets added to the folder
I created a script to add TIFF files to a map so I don't have to manually add them. I have been able to have multiple files uploaded at once but in doing so, I duplicate multiple files that are ...
0
votes
0
answers
25
views
100 feature datasets into a single feature dataset [closed]
I am running a script to pull all existing Feature Datasets from an enterprise geodatabase into a GDB. After this they need to be re-projected which is very cumbersome because you can't run a batch ...
1
vote
1
answer
21
views
Module logger not found: running web tool script that calls MDCS on server
I have a script that imports ESRI's MDCS (Mosaic Dataset Configuration Script).
When I run it as a published web tool on the server, I get the error
ModuleNotFoundError: No module named 'logger'
Is ...
0
votes
2
answers
37
views
Load a layer from enterprise geodatabase or folder in Python script for publishing as web tool
I have a script that loads a vector layer from an enterprise geodatabase (PostgreSQL database).
arcpy.MakeFeatureLayer_management(r"M:\SDE\name@servername.sde/ven.x.y","vlyr")
I ...
0
votes
0
answers
37
views
DLL Load Failed While Importing arcgisscripting: %1 is not a valid Win32 Application
I am experiencing an issue with loading the arcgisscripting module in Python. I am consistently receiving the error: "DLL load failed while importing arcgisscripting: %1 is not a valid Win32 ...
0
votes
1
answer
35
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 ...
4
votes
1
answer
141
views
Changing spatial reference of Map using ArcPy in ArcGIS Pro
Steps:
I am loading an aprx from a template, which is in WGS84 spatial
reference.
Then I do some processes.
Finally, I want to change
the MAP's spatial reference (WGS84) to another, which I get from ...
0
votes
0
answers
40
views
Python code LiDAR to 3D building footprint
I'm trying to extrapolate a 3D building footprint from a LAS file in ArcGIS Pro . As I understand it the process is filtering the LAS points, classifying the ground and non-ground points, creating a ...
0
votes
0
answers
22
views
ERROR 000735: Expression: Value is required with ERROR 000728: Field does not exist within table
I have a script written (exported from model builder 10.8), and syntax revised, to essentially to export ArcFM data to take a specific field, and bring it into another field that is not ArcFM in ...
0
votes
0
answers
64
views
Python script to copy layout template and create new layouts based off other maps in ArcGIS Pro
I am trying to write a script to use in the ArcGIS Pro Python console which copies an initial layout from an APRX (Layout1) below, then uses this to create multiple layouts which use other maps within ...
0
votes
0
answers
52
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 ...
2
votes
1
answer
37
views
Insert a variable into a lblClass expression
My script selects by date in a points layer, then creates a new layer made only of those points. The script then exports the attribute table for the new layer to Excel, turns off the original layer, ...
2
votes
2
answers
87
views
Getting SQL that defines Query Feature Class using ArcPy with ArcGIS Pro
A map in my ArcGIS Pro 3.0.3 project has a layer with a Query Feature Class as its source. I can see the SQL that defines the Query Feature Class by looking at its Layer Properties. That SQL is ...
1
vote
0
answers
34
views
Get the pixel value of a raster object using Python and ArcPy
I used the following code to get the pixel value of specific location of a DEM image (in GRID format):
import arcpy
from arcpy.sa import *
inRaster="C:\\data\\dem"
slop_temp=Slope(inRaster)
...
0
votes
0
answers
48
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 ...
0
votes
0
answers
42
views
arcpy.Describe and "in_memory": works with small feature (500 polygons) but returns "in_memory\xxx" does not exist" with large (200,000)
I'm attempting to run 'arcpy.Describe()' on an object saved 'in_memory', following 'arcpy.Intersect_analysis'.
My script works with small multi-part polygon features (500 polygons) but then returns &...
1
vote
0
answers
34
views
Assign input to submodel -- Convert PyQGIS to ArcGIS Model
I have a point feature class containing traffic counts for multiple (500) intersections (TrafficCounts) and a polyline feature class containing roads in my county (Roads). I have created a model which:...
0
votes
0
answers
22
views
Check intersections before export using arcpy
I have a toolbox that intersect many shapefiles from many folders and subfolders. But are exported shapefiles that don't intersect with the polygon or "mask". So, the output files are like '...
1
vote
0
answers
18
views
Move data with the same suffix into empty folders in ArcGIS Pro
I am using ArcGIS Pro 3.1.1
I have been able to create 75 empty group folders with this code:
import arcpy
lyr_folder = r"C:\_geodata"
for i in range(1, 76):
group_file = &...
0
votes
0
answers
43
views
ArcGIS Pro - Summarize within - 90th percentile
I have some point data which has a response time in minutes value. I've generated a hexagon tessellation and I want to calculate the 90th percentile response time for values falling within each of the ...
0
votes
1
answer
33
views
Using ArcPy to Calculate Field in hosted layer
My org has an new enterprise GIS setup with most of our editing layers living as hosted layers in AGO Portal. I want to update a field using 2 other fields but this layer has 250k assets to update and ...
0
votes
2
answers
38
views
Export To PNG not selecting correct layout
I'm trying to semi-automate exporting a layout in ArcGIS Pro using exportToPNG. I have it set up as a Toolbox script so a user enters the folder in manually, then runs the script. So there is a 'arcpy....
0
votes
0
answers
39
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 ...
0
votes
0
answers
34
views
Using Python IDLE with Notebooks
I've written a script in Python IDLE and in Notebook, both accesed within ArcGIS Pro, v2.9.5, umbrella in Start. I was trying to add the code from the Notebook into the IDLE script and was getting ...
0
votes
0
answers
19
views
Trying to run TableToTable tool to export view from SQL server database to enterprise SDE in standalone Python script
I’m trying to export a view from an SDE connection to a SQL server database to new table in an enterprise SDE database.
Both are saved as SDE connection files on a file share.
I’m getting
ERROR ...