Questions tagged [python-script-tool]

Python Script Tools are added to standard toolboxes (*.tbx) of ArcGIS for Desktop

Filter by
Sorted by
Tagged with
25
votes
3answers
7k views

Why learn/use Python Toolboxes over Python Script Tools? [closed]

I've written a few Python Toolboxes (which are new at ArcGIS 10.1), but am yet to decide whether/when I should write them rather than Python Script Tools in a standard toolbox. I thought the Online ...
12
votes
2answers
8k views

Making button that calls Python script as command rather than script tool?

I believe that in Arc9.3, commands could be created using VBA scripts. To add a custom command, you would navigate to Customize > Toolbars > Customize... and click UIControls. However, UIControls is ...
11
votes
4answers
7k views

Getting full path of layer selected in drop-down box for ArcGIS Python script tool?

I have a Python script-based tool in ArcGIS. One of the parameters for the tool is an input raster file, which I've set (using the properties of the tool within the toolbox) to be a Raster Layer. This ...
11
votes
2answers
11k views

Creating checkbox parameter in Python script tool for ArcGIS Desktop?

I am working on creating an ArcGIS tool from a Python script I am writing. I am wondering if it is possible to have a checkbox parameter. I want to have a parameter where the user selects a ...
11
votes
1answer
119 views

Python Script Performance as an ArcGIS Tool Versus Stand-Alone

Has anyone studied the difference in running a Python script in ArcToolbox versus as a stand-alone script? I had to write a quick-and-dirty script to convert a set of RGB images to single band by ...
10
votes
1answer
4k views

Creating sidebar help information for Python script tools of ArcGIS Desktop?

I have been creating custom tools (Python script tools) using Python with the ArcPy module. I can set up the tool successfully with parameters and all, but I cannot figure out how to create help ...
10
votes
1answer
7k views

Setting up Drop-Down list in Parameters of Python script tool?

I am trying to create a tool from a python script I have written that will take a list I have created and use it as a drop-down menu in the finished tool as one of the inputs (see attached image for ...
10
votes
2answers
2k views

Implementing MultiValue Parameter with Multiple Columns with Python and ArcGIS Desktop?

I am working on an ArcGIS (9.3) Python script. One of the inputs is a list of features. For each feature, I need to select a corresponding field. Setting the parameter to MultiValue gives a nice table ...
9
votes
1answer
4k views

Passing variable from ArcPy script to ModelBuilder?

I have a model that passes a variable to a python script. The script uses that variable to query some directories and return a list of paths. What I want to know is: How can I then use each of those ...
9
votes
1answer
997 views

Any performance difference between Python window and Python script tool?

Is there a difference in performance between running a Python script in the Python window versus running it as a Python script tool from the toolbox in ArcGIS Desktop 10.0? Sometimes I need to use ...
8
votes
1answer
259 views

Adding exit command to ArcGIS Python script tool?

I have a GIS script tool that creates a copy of an mxd, sets a definition query and exports a set of data driven pages based on the definition query. After it's finished exporting it deletes the mxd ...
7
votes
2answers
2k views

Automating Define Projection within Python script tool?

How would I automate the Define Projection tool so that I can just enter my layer each time? I have it as a script in toolbox, but I am unsure how to set it so I can just input my layer as ...
7
votes
2answers
3k views

ArcGIS Python Script Tool Field Name Drop Down?

I have a python script that checks file path names for corresponding files in a drive location. All of the inputs were originally hard coded, and it works well enough: import arcpy import os ...
7
votes
2answers
5k views

Choosing string from dropdown list rather than typing it into Python script tool?

As you can see, in the above picture, I need to input the county name to finish the parameter setup. Can I change the last part from inputting string to choosing an item from a dropdown list? For ...
7
votes
1answer
4k views

Can multiprocessing with arcpy be run in a script tool?

I have been tinkering around with the multiprocessing module to resolve some processing of data in ArcMap 10.3. I have created a script which works fine if I run it in IDLE. I see all my cores max ...
7
votes
1answer
3k views

Finding definitions of ArcGIS script parameter Data Type options?

When adding a python script to a toolbox in Arcgis one of the steps is to set parameters and specify what Data Type each requires. The list is long, perhaps a hundred, and many are not immediately ...
7
votes
1answer
1k views

Waiting for Python script tool to complete in ModelBuilder?

I have an Arcgis (10) model which has 2 process that need to be run sequentially. The 1st process is a python script that creates multiple rasters, but that output is not known to ModelBuilder, ...
7
votes
1answer
8k views

Using CURRENT map document in Python script tool?

I am attempting to use this code in a tool that I am working on: mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd)[0] XMIN = df.extent.XMin YMIN = df.extent.YMin XMAX =...
7
votes
0answers
480 views

Automating creation of ServiceDefinition from Python script tool of ArcPy without broken project data source? [closed]

Summary: I can create a ServiceDefinition through ArcCatalog or ArcMap, but when I try to generate the ServiceDefinition through python, it does not copy the /data folder with it, thus the script ...
6
votes
2answers
969 views

Binding Objects to List for ArcGIS Python Script Tool Parameter? [closed]

I am working on a python based script/tool. I would like to make use of drop down lists for several of the parameters. This is very easy to do if the lists are just plain old strings. Does anyone ...
6
votes
1answer
166 views

Using dot notation vs underscores when calling ArcPy functions?

I'm working on a Python script that is heavily utilizing Network Analyst tools. I understand that dot notation is used to call methods from a class, but don't really get why/how ArcPy functions appear ...
6
votes
1answer
597 views

Making Python script tool run immediately upon opening?

I have an ArcGIS 10.1 script tool that creates an ArcSDE connection folder and copies data from the server to a new folder on the users computer. The tool has no parameters runs fine but when you open ...
6
votes
2answers
7k views

Can input parameter be optional and Python script tool work when input is not provided?

I'm building a script tool that processes shapefiles ( GPS data collected on weekly basis). The tool is set up to take an input for each shapefile ( in this case Sewer, Storm, Sign). On some days, ...
6
votes
1answer
2k views

Programmatically Populate Value List in ArcGIS Tool Interface?

I'm just trying to set up the parameters in a tool I've built in ArcGIS. What I want to do is read in a feature class or table and get the values in a specific field called "SITE". The field contains ...
6
votes
1answer
1k views

How to fill Field Mappings parameter in script tool on updateParameters?

My goal is to get a list of fields choosen by an user from existing fields in feature class. I think that I can show all fields in Field Mappings dialog, an user deletes unwanted fields and I get a ...
6
votes
1answer
11k views

Getting arcpy.AddMessage() to display message from script tool called from another script tool?

I am using a Python script tool within an ArcToolbox in ArcGIS 10.2. The script calls another python script tool while running but does not display the messages from the called script when using ...
6
votes
1answer
1k views

Organizing files for large Python script tool?

I am writing a lengthy ArcPy tool and am working with multiple python scripts, simply for organization's sake. Everything runs well when I run it from the command line, but now that I am starting to ...
6
votes
1answer
1k views

Creating list of strings as parameter to Python script tool?

I am trying to have a list of strings to pass as parameter to my script: when I start the script it displays: With "Add Value' button disabled. What am I missing here?
6
votes
2answers
5k views

Calculating field in ArcGIS Desktop using ArcPy cursor?

I'm trying to calculate a field based on the values of others in the same layer in a calculation. I can't work out why its not working. I've even cut everything down to just be based on one field and ...
6
votes
1answer
3k views

ArcGIS median value from layer?

I've been hunting around ArcGIS 9.3 and having no success at finding a tool/function that can give me the median (not the mean/avg) tabular value of a spatial database. For example, if I have a data ...
5
votes
2answers
19k views

Setting workspace as Python script tool variable/parameter in ArcPy?

I'm trying to write a script and as I want to automate it as much as possible. Is it possible to set the workspace as a variable so that when it is run as a standalone script, or as a tool in ...
5
votes
1answer
111 views

Python script into model

I have a toolbox to share with my collegaues, it includes a model and imported python script. This script is also imported to the model in the end of session. When I share this toolbox to another PC, ...
5
votes
5answers
3k views

How to add Radio Buttons to Python Script tool dialog?

I have 3 Point shapefiles for 3 species that contains the accession points of each. The user needs to specify only one species at a time. I need to write a script tool for adding the selected Point ...
5
votes
2answers
574 views

Removing “(optional)” from parameter description in Python script tool dialog?

I am using ArcGIS 10.2 and create a script tool in toolbox for attribute search on a layer, all the searching criteria is not compulsory, and user can combine multiple search criteria. But in the ...
5
votes
1answer
339 views

Configuration problem anaconda python in ArcGIS

I used Eclipse with PyDev to create a script in Python (windows 7 x64). My code runs perfect when I start the run in Eclipse, but when I add it as a Tool in ArcGIS 10.1, I have the following problems: ...
4
votes
4answers
229 views

Problems with for iteration in arcpy

I want to fill a new field in a shapefile using arcpy. I have differents values so I am using for iterator to run all rows. But when I run the code all rows are filling with the latest row value. The ...
4
votes
2answers
2k views

Adding output parameter to Python script tool?

How do you add an output parameter in a python script in a toolbox?
4
votes
2answers
2k views

Convert a Toolbox (.TBX) to a Python script (.PY)?

I have a .tbx tool box, which runs a script that is incredibly slow. So what I want to do is to open the python script that is running below the .tbx and make some changes or perhaps write something ...
4
votes
1answer
859 views

Adding parameters to category in Python Script Tool?

There is plenty of documentation on how to add parameters to a category in a Python Toolbox i.e. see the bottom of http://resources.arcgis.com/en/help/main/10.1/index.html#/...
4
votes
3answers
5k views

Working around ArcGIS Pro inability to export models as Python code?

ArcGIS Pro 2.1 does not allow saving / exporting of a model constructed with ModelBuilder as a Python script. It seems that the only way we can circumvent this limitation is to click on each ...
4
votes
1answer
2k views

Extract values from a field to a list in Python (arcpy)

I have a define function ( uniqueList ) in a module which sets the unique values from a list. I'm importing the function to a new script to set the unique values from a field 'COVER', after i've set ...
4
votes
1answer
102 views

Creating selection record using ArcPy and Python script tool?

I want to create a tool that list records of a field in the selection part and move some of records to the right pane. How can i create the UI using ArcGIS and a Python script tool in a standard ...
4
votes
1answer
453 views

Converting python script to toolbox?

I am trying to convert my plain python script to script in ArcToolbox to share, where user can set input data (in this case, feature class). Unfortunately, Converting Python (ArcPy) script into tool ...
4
votes
3answers
1k views

python script tool validation checkboxes to radio boxes?

I am trying to build a tool in arcmap, which uses radio buttons in its gui. Since I read, that radio buttons are not supported, I figured, it couldn't be too hard changing the behaviour of simple ...
4
votes
2answers
397 views

ArcGIS Toolbox, parameters for python script not as positional arguments

I have an ArcGIS Toolbox with a bunch of parameters. A python script is used to perform some raster operations, based on this parameters. I am using Python argparse in the script to get the parameters....
4
votes
1answer
564 views

Error when running Extract by Mask Script

I am using ArcGIS 10.3 Desktop to write a script tool to, among other things, extract raster data using a mask. I keep getting these errors: ExecuteError: ERROR 000875: Output raster: C:\...
4
votes
1answer
577 views

Is there String Size Restriction in ArcGIS Python Script Tool parameter?

I'm trying to post a list of unique ID's (as a string) to a Python script tool for processing by ArcGIS Desktop 10.0. The list may be 50k+ id's long (~450kb). e.g. "237434,237435,237436,237423,...
4
votes
1answer
748 views

Making multivalue input script run from Python script tool?

I have a working python script: import arcpy sdeconnection = arcpy.GetParameterAsText(0) layerfiles = arcpy.GetParameterAsText(1).split(";") for layerfile in layerfiles: print layerfile lyr ...
4
votes
1answer
274 views

arcpy.CalculateField_management doesn't recognize variable in code block

I found a useful field calculator code block that I'm trying to add to a custom python tool. It works great in the manual field calculator; however, when inserted into the code block text to be used ...
4
votes
1answer
464 views

GP service (from Python script tool) time-out: how to execute finally: statement

I am trying to build more fail-management logic into some of the GP services I develop. As a part of the business logic within the script tool I build, I write some data into the tables and thus lock ...