Questions tagged [python-toolbox]
Python toolboxes are created entirely using Python in ArcGIS for Desktop and stored as *.pyt files
316
questions
0
votes
0
answers
6
views
Values in second columns of GPValueTable Parameter reset after tool is ran
I am trying to create a .pyt python toolbox tool in arcGIS pro and the issue I'm running into is that Values in second columns of GPValueTable Parameter reset after tool is ran.
The parameter created ...
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
...
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 ...
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 ...
1
vote
0
answers
31
views
ArcMap PYT toolbox open so slow every time starting new .mxd
I am using ArcMap 10.8.
If I put this class (code below) in a empty PYT toolbox, it will take more than 10 seconds to open, everytime starting a new mxd.
So far I find the reason is the default value ...
3
votes
2
answers
109
views
Closing single map view in ArcGIS Pro using ArcPy
Using ArcPy for ArcGIS Pro 3.1, is it possible to close a particular map view if it is open but not any other open map views in an ArcGIS Pro project?
Currently my tool uses "aprx.closeViews(&...
0
votes
1
answer
87
views
Which parameter data types in a Python toolbox for selecting a path
I need to select a SDE PATH based on user selection on Python toolbox at ArcGIS Pro 2.7.1 and use this path
at the code for setting like
fc = 'Zone'
SDEDir = inputPath
arcpy.management.CalculateField(...
3
votes
1
answer
69
views
ArcPy toolbox - How to limit GPFeatureRecordSetLayer to interactive rectangle input
The issue
I have an ArcGIS Python Toolbox for which I would like the user to be able to interactively define an oriented rectangular extent (bounding box + rotation) as input parameter.
I currently ...
2
votes
0
answers
61
views
Developing a Python toolbox for multi decision criteria analysis
I am trying to get my hands dirty with Python toolboxes (.pyt) for ArcGIS Pro.
I've learned a lot about how to configure the parameters for the ArcGIS Pro GUI, but my lack of SQL knowledge is really ...
0
votes
0
answers
72
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
2
answers
79
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
367
views
ArcGIS Pro - ArcPy script exports PDF fine via Python window, but omits a layer when used as a Python Toolbox
I'm getting strange behavior from ArcGIS Pro 2.9.4 / ArcPy 2.9.
In a nutshell, I have an ArcPy script that exports PDF maps correctly if I run it in Python Window, but omits one specific layer when ...
4
votes
2
answers
288
views
Python script in toolbox
I have a python script that clean my symbology for the selected layer, from here:
from qgis.core import *
from qgis.gui import *
from qgis.utils import iface
layer = iface.activeLayer() # get the ...
1
vote
1
answer
377
views
Calling table frame layout element from Python Toolbox using ArcPy
I created a Python Toolbox which calculates statisitics about some layers and print a pdf layout.
The layout and table frame elements already exist.
I try to access the table frame elements from my ...
1
vote
1
answer
116
views
Arcpy.CreateTable_management in Python toolbox not creating table in memory
The following creates a table in memory as expected when executed in the Python window [ArcGIS Pro 2.9, Windows 10]:
arcpy.CreateTable_management('memory','dataTable')
When I try to do the same thing ...
0
votes
1
answer
78
views
Arcpy.CreateTable_management fails in Python toolbox (.pyt)
I am trying to create a table within a Python toolbox (.pyt). This works with file GDB's, but I would like to use a memory dataset if possible.
A table can be created in memory manually or by calling ...
2
votes
1
answer
370
views
Set user input as path for saving Python toolbox results
I created a Python toolbox to run in ArcGIS Pro 3.0.
I wish to save toolbox results in another geodatabase than the one by default, which contains input data.
This toolbox will be run by several users ...
2
votes
1
answer
611
views
Using multiValue parameter with ArcPy and ArcGIS Pro
I am using ArcGIS Pro.
I want to make a Python toolbox tool (*.pyt) where I put for input multiple layer's and to apply a buffer for every input. I want every buffer to put another distance. After I ...
1
vote
1
answer
207
views
Python Toolbox updateMessages - Remember message from an earlier validation?
Is there a way to retain Warning or Error messages for parameters between tool validation calls?
In my example below, I want to check the input feature class for something, and add a warning message. ...
0
votes
1
answer
1k
views
Trying to Call a List From a Function within one Class to Another Class
I have an Python Toolbox script that contains two classes/tools. I want it so that the user inputs the data into the first class and then the second class will handle the processing.
How can I write ...
3
votes
1
answer
176
views
ArcGIS Python Toolbox - Reordering parameters and reference by name instead of index
Is there a way to reference parameters in an ArcGIS Pro Python Toolbox by name, instead of by numeric index / positional argument?
I built a data entry tool in a Python Toolbox that has over 100 ...
0
votes
1
answer
517
views
Implementing FieldMapping parameter in ArcGIS Pro Python Toolbox tool to map fields in two tables
I am trying to create a tool within a Python Toolbox in ArcGIS Pro that will accept a table and a featureclass and allow a user to map the fields from the feature class to fields in the table. ...
1
vote
1
answer
191
views
Restricting one parameter value list against another's chosen value in Python Toolbox using ArcPy with ArcGIS Pro
I have a script loaded as a toolbox into ArcGIS Pro. It has two multi-value string parameters.
Is there a way to restrict the second parameter's list against the first?
For example, if a user picks &...
1
vote
1
answer
565
views
Reading local file from Geoprocessing Service on ArcGIS Server
I have a Python toolbox which I would like to publish to our ArcGIS Enterprise 10.8.1 environment. I use ArcGIS Pro 2.7.3 for publishing. The Python toolbox reads from a configuration file on the file ...
1
vote
1
answer
267
views
Accessing built in coordinate systems from ArcGIS Pro Python Toolbox tool
I am attempting to create a custom ArcGIS Pro Python Toolbox tool and some of the geoprocessing tools I use run slowly or not at all if the input DEM or environment is not projected first. I would ...
1
vote
1
answer
102
views
How can I evaluate the environment level within a Python toolbox
According to Esri:
There are four levels of environment settings: application, tool, model, and model process.
https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/what-is-a-...
3
votes
1
answer
546
views
How to suppresss Python Toolbox from adding output datasets to the map
I wrote a Python Toolbox and would like to suppress it from adding output datasets to the active map. Below a minimal example (not the actual toolbox):
import arcpy
from typing import List
class ...
0
votes
1
answer
253
views
Does Web AppBuilder GP Widget handle validation from Python Toolbox published as GP Service?
I have created a python toolbox in ArcGIS Pro that I want to share as a GP Service. The user inputs their Portal URL, username, password and the GIS Server parameter dynamically provides a dropdown ...
0
votes
0
answers
246
views
Setting a .sde connection file as a default value in an ArcPy toolbox
I am building a tool to run some routine data maintenance on an Enterprise geodatabase with Python. I would like to set the default value for one of the parameters to database connection file on disk. ...
4
votes
2
answers
607
views
Using Python Toolbox Parameters
I want to specify an input for each column of the 'field compare' parameter, so it would be 'baseFeatures' would link just to the 'Base Fields' column and 'updatedFeatures' would just link to the '...
0
votes
1
answer
63
views
Toolbox For ArcGIS Desktop 10.5 not working for all values
I'm trying to build a toolbox, and I would like users to be able to select two possible values from two lists.
The first list is stored in a JSON, that I access using HTML.
The second list is also a ...
1
vote
1
answer
333
views
Autocomplete for input parameters in a Python toolbox for ArcMap (or ArcGIS Pro) [closed]
Is there a way to get word completion to work for string parameter inputs in a Python toolbox? We are working with very long value lists (a few thousand entries per list) and scrolling the drop-down ...
1
vote
1
answer
870
views
Getting simple ArcGIS Python toolbox parameters to be enabled or disabled on load
I am attempting to get a simple ArcGIS Python toolbox (pyt) set up that allows me to present a subset of appropriate parameters based on selection from a 'parent' parameter. There are 7 (0-6) total ...
1
vote
0
answers
50
views
Could not make join work in toolbox but works in Jupyter notebook
I am selecting points from the map and roads and trying to join them based on my picks. It works in Jupyter notebook however it does not work in toolbox and I could not figure it out. I tried to ...
3
votes
1
answer
181
views
Getting new parameter after Python Toolbox gets executed
I am trying to build a toolbox which would first take some inputs and execute some code and return me results. After the results I would like toolbox to ask me for new parameters so I can use these ...
2
votes
2
answers
851
views
Grouping Parameters in Python Toolbox of ArcGIS Pro
I am making a Python Toolbox for ArcGIS Pro. The main tool in the toolbox needs to have 5 radio buttons: Users can select any number of options (from 0 to 5).
Is it possible to group or cluster the ...
-3
votes
1
answer
69
views
Data Type that can be used to select Desktop as a folder in ArcGIS Python Toolbox (ArcGIS Desktop: ArcMap 10.6)
I have created a Python Toolbox. While setting up my tool, in the parameters I am trying to find a data type to use in order to select Desktop as the location to create a folder.
I need to find a ...
2
votes
0
answers
671
views
UpdateCursor cannot acquire lock if attribute table is opened in ArcGIS Pro
I wrote a script tool for someone to allow them to clean all whitespace errors (leading/trailing spaces, 2+ consecutive white spaces, convert empty strings to nulls), and aside from one issue it works ...
3
votes
1
answer
281
views
Python Toolbox with Many AddField() Calls Runs Slower With Attribute Window Open
I recently finished developing a Python toolbox tool that ends up calling the arcpy.AddField_management() function about 25 times or so. I first developed it as a standalone script to get it working ...
1
vote
1
answer
418
views
ArcPy - Get Date as parameter value and calculate Date field
In my ArcPy script I have an input parameter for the Date, so the user is asked to input a date value (time is not needed) using the data type GPDate.
In the script I calculate a new field, field data ...
2
votes
1
answer
497
views
Generating multiple page reports (Page Per Report) using ArcGIS Pro & Python
I have reached a point a little bit outside of my knowledge frame. Python.
I found that I can create multiple page reports with Python in ArcGIS Pro by combine 2 reports together. I am following this ...
2
votes
0
answers
118
views
Layer no longer renders on map after running custom Python Tool
Please note: I believe this is a display issue, since the data isn't disappearing from anywhere but the lines on the map.
When I run a custom Python Toolbox in ArcGIS Pro 2.7.0, the layer that was ...
0
votes
1
answer
239
views
Creating a Toolbox in ArcGIS Pro that can export results into an image format [closed]
How can I create a Toolbox in ArcGIS Pro that can export results from point and line feature classes and combine them into just one image format (e.g. .jpg, .png).
like so
1
vote
2
answers
195
views
JoinFeature attribute_relationship syntax (arcpy)
I am building a Python Toolbox for ArcGIS using Python 3 with ArcPy. I have two tables that I need to relate based upon an attribute. The information on the documentation for the JoinFeatures() ...
2
votes
1
answer
21
views
Writing program to get datatypes of certain fields and then do some work on that but SearchCursor makes everything tuples
I am trying to write a program to get the datatypes of certain fields and then do some work on that but SearchCursor makes everything tuples.
How do I bypass this situation and get the actual datatype ...
2
votes
1
answer
581
views
How to access a "geoprocessing value object" when a row in ValueTable is empty (Python Toolbox)
I have a tool with a ValueTable consisting of two columns - text (GPString) and layer (GPFeatureLayer).
When I fill the parameter with desired values (field names in the first column, some feature ...
1
vote
0
answers
24
views
Customizing ArcGIS toolbox layout [duplicate]
I am trying to create a customized tool in ArcGIS using Python Toolbox. Does anyone know how I can change the appearance (for example, size of a textbox or position of a parameter) of a parameter on ...
1
vote
1
answer
137
views
ArcGIS Reclassify fails in Python Toolbox
I'm trying to build a Python Toolbox to analyze submarine landslides. Among other things I want to run the aspect tool and then reclassify the aspects into groups with a 45 degree interval. Therfore I ...
2
votes
1
answer
333
views
For loop for access to a directory files in ArcPy
I have a Python Toolbox and I want to use a directory to read different shapefiles. But when I run the script It only works for the first shape.
fd is the directory and the code is:
fd= parameters[0]....
2
votes
1
answer
942
views
Error: local variable referenced before assignment in ArcPy
I have a directory with contain others subdirectory with shapefiles.
I access to the shapefiles using a for, but then when I ned to use the variable shape that I get this message:
UnboundLocalError: ...