Questions tagged [arcpy]
A site-package created by Esri to expose ArcGIS Desktop (ArcMap and ArcGIS Pro) geoprocessing, mapping, etc, to Python.
10,534
questions
0
votes
0
answers
11
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 ...
0
votes
1
answer
27
views
Turning off layer visibility in ArcGIS Pro with Python
I have code that exports several maps. For a set of maps, I want to make sure one layer used in a previous map is turned off. I don't want to remove it completely.
Anyone know what I am doing wrong?
...
-3
votes
0
answers
15
views
I have problems with installing plugins ArcPy [closed]
ArcGIS Pro and deep learning libraries for ArcGIS Pro must be installed in the same installation context (as both the user, and as both per machine)
0
votes
0
answers
20
views
How do I cut multiple .tif files into a shape define by a shapefile and output result as a .vrt? (and how do I optimse the result?) [closed]
So I have a few large .tif files which I want to merge and then mask according to shape files. I want to mask each .tif separately and output the result as a .vrt. I then want to combine the ...
0
votes
0
answers
30
views
Why does arcpy.da.Describe return different keys for same feature class based on location?
I have a file geodatabase on a remote desktop with the following layer:
r'C:\Folder\Database.gdb\Feature_Dataset\Feature_Class'. If I copy this entire gdb to my local machine, da.Describe does not ...
0
votes
1
answer
12
views
Converting multipart line Feature class into individual .kml files based on particular attribute table using ArcGIS Pro [closed]
In ArcGIS Pro I have a drainage network features class which I split into grids using fishnet grid template and now I have drainage network sliced into fishnet grids. It has one of its attributes ...
0
votes
0
answers
29
views
Edit PostgreSQL database with ArcPy [closed]
I have an ArcPy script that works locally with a .gdb database and create some features in this local DB. I would like to migrate my infrastructure on a server and do the same work but on a PostgreSQL ...
-1
votes
0
answers
36
views
Calculating cumulative catchments using Python 2.7.16 in Visual Studio Code
I am trying to get cummulative catchments from a table in ArcMap using a table. I am using four fields namely Area(Load), CatName(cid), fromNode and toNode. I want the fifth table to be populated with ...
-1
votes
1
answer
35
views
Moving points based on updated x,y values [closed]
In an ArcGIS Pro project, I have a feature class with over 2,000 points and I have updated the x,y fields of about 100 of these using a script. I now need the locations of these points on the map to ...
0
votes
0
answers
26
views
ArcGIS Pro - Python script error raster file name [closed]
I am trying to reclassify and set the same extent for a large dataset. I have tried to create a toolbox Script with no success and now running the code through Python Window. Below is the full script ...
3
votes
1
answer
63
views
Using page query with python
I am trying to automate a process in ArcGIS pro using python. In this process I create several maps using a map series. I use a page query to filter my data based on the map series page name.
I can't ...
0
votes
0
answers
26
views
Results of tool differing between geoprocessing tool and running tool in Python [closed]
I am running the Slope tool in the Spatial Analysis toolbox in ArcGIS Pro on a DEM (Output is purely for visualisation). When I run it in the toolbox, I get a result however when I export the tool as ...
2
votes
1
answer
37
views
How to increase line width?
I have a script that changes the symbology to unique values, but I can't figure out how to adjust the width?
#isolate the symbology of the selected layer
sym = lyr.symbology #set the symbology as ...
1
vote
0
answers
47
views
Ignoring Python warning messages in ArcMap
I want to calculate the OD Cost Matrix in ArcMap 10.3.1 using the ArcPy package. When running the arcpy.Solve_na, the Python console prints a lot of warning messages. After a while, ArcMap crashes, ...
0
votes
0
answers
61
views
FlowAccumulation working when run as geoprocessing tool but not in ArcPy
I have a problem with this code:
#actual problem code
flow_dir_rast = flow_dir
in_weight_raster = mine_flac_weight
data_type = "FLOAT"
flow_direction_type = "d*"
# run the flow ...
0
votes
0
answers
48
views
Internationalization/localisation for environment variables arcpy GP tool
I had gone through the below post to achieve localisation for log messages in history tool using messages.xml as well as for parameter labels using toolbox xmls.
https://pro.arcgis.com/en/pro-app/...
-1
votes
0
answers
32
views
Runtime Error - Detect Objects Using Deep Learning (ArcGIS Pro)
I am attempting to automate the Detect Objects Using Deep Learning tool in ArcGIS Pro using a python script. Unfortunately I am running into a Runtime Error when I attempt to execute the block of code ...
-1
votes
0
answers
33
views
find the length from the centre of gravity of the polygon to the vertices [duplicate]
I am looking for a Python code that calculates the average lengths from the center of gravity of an irregular shape to all the vertices of the shape on ArcGIS Pro.
1
vote
1
answer
51
views
Importing CSV file in ArcGIS Pro ArcPy script using relative paths
I have a CSV file in my toolbox folder. I would like to import the CSV file into my arcpy script to run in conjunction with my arcpy script.
Folder structure:
src
data
my_csv.csv
mytoolbox.pyt
...
2
votes
0
answers
55
views
Removing joins to layers using ArcPy in ArcGIS Pro
I have some layers that point to feature classes in a geodatabase. Some of the layers are joined to a table also in the geodatabase and I am trying to remove all the joins so that I can run some other ...
0
votes
2
answers
47
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 = ...
0
votes
4
answers
98
views
Adding Field Map to Append using ArcPy
I have a folder of shapefiles which I want to append to project geodatabase feature classes using ArcPy.
So far, as I am testing with just a few shapefiles, the script works fine as long as all the ...
0
votes
1
answer
35
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 ...
1
vote
0
answers
38
views
How to fill/calculate a field in ArcGIS 10.5 based on condition of another field using Python [closed]
I have three fields in a featureclass. they are G_landuse (General Landuse), detail_lan (Detail landuse) and Type. Some values of G_landuse are blank.
I want to fill all blank values of G_landuse ...
0
votes
1
answer
31
views
Create a new GPFeatureLayer from data frame
I am a complete newbie to ArcGIS/ArcPy. I am creating a new Python Toolbox, that reads in a GPFeatureLayer, and also should return one. I read in the values of a GPFeatureLayer row by row. Then I ...
1
vote
2
answers
79
views
ArcPy intersection method passing in two polygon features returns an inaccessible line feature object
I'm trying to calculate the area of two overlapping surface elements in order to calculate the area overlap between them.
Then I used the intersect method to get the overlapping area of polygon A and ...
-1
votes
1
answer
40
views
ERROR 000732: Input Rasters: Dataset input_dem does not exist or is not supported
Context : DEM Modification using shapefile.
Scenario: Change elevation values of the dem using a polygon shapefile. Update the elevation values within each polygon according to the values specified in ...
0
votes
1
answer
66
views
Changing Arcpy Message-Warning-Error Text Colors
I recently came across a post about changing "the default error color in python" and was interested in doing something similar with Arcpy's AddMessage, AddWarning, and/or AddError functions. ...
0
votes
1
answer
27
views
Python Toolbox - Parameters drop down list will not update with new parameter
I am making a python toolbox for ArcGIS Pro 2.9.8 with arcpy in Python 3.7
I have a workspace parameter defined as
param1 = arcpy.Parameter(
displayName="Feature Dataset or Geodatabase ...
0
votes
0
answers
28
views
Save group layer to a layer file using arcpy (Convert Labels to Annotations)
I am running the "Convert Labels To Annotation" tool in ArcGIS Pro using the Python window. I need to save the output group layer to it's own lyrx file.
According to the tool documentation, &...
0
votes
0
answers
43
views
Check for ESRI geometry validity using shapely or similar
I have a geopandas dataframe in Python. Is there a way to check geometry validity under the ESRI scheme as opposed to the OGC spec using shapely/geopandas/some hacky way, or am I constrained to using ...
0
votes
1
answer
75
views
Difference between "ESRI" and "OGC" validity
When I use the Check Geometry tool in ArcGIS Pro, it asks whether I want to validate using ESRI or OGC methods. What is the difference between these two methods?
edit
I originally asked a second ...
0
votes
1
answer
38
views
WKT Conversion: Object: Error in executing tool
I have a script below where I am trying to convert a CSV of a WKT polygons that I would like to export out into a shapefile and keep getting the following error on line 21 with: arcpy.management....
2
votes
2
answers
165
views
How to add a custom tool to ArcGIS Pro tab/ribbon
In ArcMap, we were able to customize the toolbar to add our own Python or ModelBuilder tools. I'm trying to figure out how to do this in ArcGIS Pro but not having any luck. I am able to add a new tab ...
0
votes
1
answer
25
views
ArcGIS Pro Stops working after running a script on ArcGIS Notebook and generates error after a long pause
I was trying to perform Downscaling a Prediction Model Using ArcGIS Notebooks and ArcGIS Pro using the datasets provided by ArcGIS Lab and their instructions from this mannual. The provided code is:
...
1
vote
0
answers
32
views
Edge holes created from ArcPy script
I'm working on creating floodplain polygons from Base Level Engineering Depth grids.
When running this script I end up with holes that don't get filled in on the edges, as circled in red in the image ...
0
votes
0
answers
42
views
ArcPy JoinField Error 000574: Python is not installed
I am new in coding. I am trying to add a field of to my attribute map using "Zonal statistics as Table" and "Join field" tools. For the last one I am using arcpy.management....
1
vote
0
answers
23
views
Create a ArcGIS Online group with some specific settings using ArcGIS Python API
Those line of code create a new group with some specific properties and settings. But its not working for display_settings properties and Group membership settings (Who can view this group?) I set as ...
1
vote
1
answer
58
views
arcpy Geometry pointFromAngleAndDistance method
In my workflow I decided to use pointFromAngleAndDistance method and was surprised by output.
Script below:
import arcpy
import prettytable
from prettytable import PrettyTable
maxDistance = 100.0
SR = ...
0
votes
1
answer
32
views
Using arcpy, need to find which polygon each set of coordinates in a table intersects with
I'm writing a Python script tool for ArcGIS Pro and among other things, I need it to compare coordinate values (lat & lon) in a GDB table to a polygon feature class and determine which polygon ...
0
votes
1
answer
44
views
Error publishing feature layer using ModelBuilder in ArcGIS Pro
I've created a model in ArcGIS Pro ModelBuilder which attempts to carry out the following:
Variable: Database connection (sql server)
Make Query Layer (input = Database Connection, output = "...
0
votes
0
answers
40
views
Get errors featureclasses of Trace Network ArcGIS Pro
I try to analyse road featureclass for errors of topology and I use Trace network tool in arcpy.
I cannot just create topology and add some rules, because it doesn't work like I want.
When I use the ...
0
votes
1
answer
59
views
How to use CIM in Python to enable time?
I'm trying to automate with Arcpy enabling time for the layers in my Drawing order but can't figure it out. From digging I've found that the only way to do it is through CIM but there's limited ...
0
votes
1
answer
57
views
Quickly convert point features to raster using ArcPy or GDAL [closed]
I have a very large point feature collection, about 40 million points, which are obtained by raster conversion, so the arrangement of points is regular (the distance between two columns of points is ...
0
votes
1
answer
30
views
How to use Python to update enterpise geodatabase user connections for layers within an ArcGIS Pro Project map
I tried to use the following code to update the connected database user for layers within an ArcGIS Pro project map. The code runs but it does not change the data sources from one enterprise ...
0
votes
1
answer
50
views
Updating the source geodatabase for select layers in ArcGIS Pro (multiple geodatabases used in one map)
I have a map that uses shapefiles from several geodatabases. I need to re-source several layers from one specific geodatabase to another. They are the exact same geodatabase; Geodatabase X was copied ...
0
votes
1
answer
56
views
Adding data to existing .aprx layout and zooming to extent of new data using ArcPy with ArcGIS Pro
I need to add data to an existing .aprx layout and zoom to the newly added data extent. Then, I need to export layout with new data as a JPEG.
This workflow is not clear online. My data is not in a ....
0
votes
0
answers
46
views
Differences between the size of the output area when using Polygon's symmetricDifference method versus the Symmetrical Difference tool in ArcGIS
I have two overlapping polygons to compare (using ArcGIS Pro 3.0) originated from a DWG file. One as a polygon (closed polyline in AutoCAD). The second as a 3D solid converted to polygon using ...
0
votes
2
answers
42
views
Symbology to layers not working
I want to apply layer symbology to all TIFF in a group layer but it does not work:
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
df = mxd.activeDataFrame
groupName = "New ...
0
votes
1
answer
40
views
Select Layer by Attribute not working with variable, but doesn't give errors using ArcPy
I'm trying to make a simple script tool that allows the user to search a for a specific polygon in a feature class using a unique number.
Using the python window in ArcGisPro I run arcpy.management....