Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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 ...
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
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 =...
2
votes
1answer
233 views

Deriving input based on other parameters in Python script tool?

I have a folder and it contains two feature classes, e.g., a.shp and b.shp. The script tool created has two parameters. The first one is the model location, and the second one needs a feature class (a....
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 ...
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 ...
3
votes
2answers
2k views

Trace Geometric Network in custom script tool?

I'm trying to make a Python script tool which uses the Trace Geometric Network tool (10.3). My script works in the Python window, but as a script-tool, it runs and NOTHING HAPPENS. Messages state: ...
3
votes
1answer
188 views

Controlling Categories in Script Validation Tools - Expanding Groups By Default

The validation tab in your script tool properties allows you to put parameters in categories. The help states: Put parameters in different categories. Categories are expandable window shades with ...
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 ...
4
votes
1answer
860 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
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 ...
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 ...
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 ...
2
votes
1answer
217 views

Cannot Edit Python Script tool using its context menu from ArcMap/ArcCatalog? [closed]

I am unable to edit scripts in ArcMap or ArcCatalog. I navigate to the script, right-click on it and select "Edit", then nothing happens. I am using notepad++ as my editor (set in geoprocessing ...
1
vote
1answer
181 views

Passing File from Python Script to ModelBuilder tool?

I have a script that produces a text file. The name of the text file it creates is determined by the input parameters chosen by the user. The user chooses what Layer, Stress Period, and Time Step to ...
1
vote
1answer
228 views

Cannot run some Grass commands in Python using grass script

I am trying to make a Landsat geoprocessing script for calculating vegetation indices using Grass modules and Python. I am fairly new at using Python for Grass and I have managed to call and create ...
-1
votes
1answer
256 views

Why is Python Script (using XYTabletoPoint) Deleting target Feature Class? [closed]

When I run the following script (using Arc 10.2.2): import arcpy if __name__ == "__main__": # Get Parameters Source_CSV = arcpy.GetParameterAsText(0) Target_FC = arcpy....
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 ...
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
1answer
121 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 ...
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 ...
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?
3
votes
1answer
3k views

Converting Python (ArcPy) script into tool or toolbox script?

I've written a simple python script that allows me to quickly create a copy of a template Mxd, pointing to different shapefiles. The user specifies the new location, a name for the new mxd, then the ...
2
votes
1answer
897 views

Getting multiple value pairs as Python Script tool parameter?

I've tried several different data types but can't figure out how to allow a user to create a list of elevation-temperature pairs. For example, a spreadsheet might look like this: Is there a ...
2
votes
1answer
2k views

Using ArcPy FieldMappings for Spatial Join?

I'm trying to create a python script tool to use within ArcMap 10.1. I created a Model and exported it as a python script and added custom field mappings for the first Spatial Join by reading through ...
1
vote
2answers
1k views

How to keep a parameter blank in a script tool?

I've developed a sort of find and replace script tool that functions. But I'm not able to figure out how to find empty cells in fields and replace them.For the "Find" parameter, I have tried entering "...
1
vote
2answers
1k views

Alter validation in ArcGIS script tool

I have a script tool in ArcGIS 10.1. Some of the parameters are optional and if they are left blank, will not be processed. They are numerical parameters and I want to enforce this in the tool, so an ...
9
votes
1answer
999 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 ...
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
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?
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
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,...
3
votes
1answer
169 views

Generating SQL expression from multivalue pick list in ArcGIS tool

I have created a script tool that allows users to select a single value from a pick list, which gets inserted into a query expression. The pertinent part of my code is pretty simple: Input = arcpy....
3
votes
0answers
357 views

Adding error message to parameter if seperate derived multivalue parameter is empty using ArcGIS tool validation? [closed]

I have three tool parameters; an input point feature class, a (multivalue) list of fields derived from the input feature class and an output file location to export to Excel. I have filtered the ...
2
votes
1answer
1k views

Embedded python script module import issue

I have two ArcGIS python scripts. One is a primary python script that calls a number of functions from a second python script. Everything works well, i.e. primary tool calls and uses functions from a ...
2
votes
4answers
4k views

Using Python new line (\n) with ArcGIS geoprocessing progress dialog? [closed]

I am currently using in my ArcGIS 10.3 toolbox script; # Get the spatial reference spatialRef = arcpy.Describe(template).spatialReference.name #Loop through shapfiles in folder and reproject for fc ...
2
votes
3answers
109 views

Stacking multiple selected points in ArcGIS

I would like to find a way to stack multiple selected points in ArcGIS, either using the field calculator or python script. For example, I want to snap all points representing houses on a street into ...
2
votes
1answer
60 views

Why is “arcpy.GetParameterAsText” deleting Target Feature Class?

Originally I asked Why is this Python Script (using XYTabletoPoint) Deleting the target Feature Class?, but have since narrowed down the line that is deleting my target Feature Class. Surprisingly, ...
2
votes
2answers
1k views

Using Python Script tool in ModelBuilder to check if field exists, if not, create one?

I'm trying to create a script tool to use in ModelBuilder that will check the incoming dataset for the existence of a particular field. If the field exists it should simply go on to the next calculate ...
2
votes
1answer
485 views

Filter the Feature Layer parameter in Python Script Tool

I have a Python script tool where I have a parameter of type Feature Layer because I want to have the already opened layers as a dropdown list. I was wondering if there is a way to filter this ...
1
vote
1answer
33 views

Limiting feature class parameter to specific geodatabase?

I have a tool that will update the geometry of a feature class based on the geometry of another, using a common identifier. It works great but the way I have it set up, you have to first select the ...
1
vote
1answer
239 views

For-Looping through Bookmarks in Python Script tool?

I'm using this script tool, in ModelBuilder for ArcGIS Pro, to set up a map layout, reference a bookmark, and export the layout as a PDF. This model iterates through Urgent Care centers and its ...
1
vote
1answer
146 views

Writing Python script tool to enable ModelBuilder to skip over rasters without data?

This modelbuilder works well until the raster to polygon step. At that step, rasters without features cause an error(error 010151). I would like to put in a step before raster to polygon that causes ...
1
vote
4answers
9k views

NameError: variable not defined even though set multiple times

This code original worked when run through the python command window in ArcCatalog. After I added the script to a toolbox I have had all sorts of troubles. The most frustrating error has been: ...
1
vote
1answer
62 views

What is the right SQL query for this case? [duplicate]

I want to use input string in part of the SQL query, and the code has been posted below. import arcpy import os in_features = arcpy.GetParameterAsText(0) target_county = arcpy.GetParameterAsText(1) ...
0
votes
1answer
289 views

Create an Identify Route Locations tool that converts M values

I have a data set with many maritime routes that I would like to see the m values (time) for. ArcGIS's Identify Route Locations tool works exactly as I want it to, however, the m value displayed is ...
0
votes
1answer
144 views

Sourcing Layer in TOC to New Feature Class using ArcPy?

I'm trying to source a layer in my TOC with a new feature class. I've read countless forums, ArcGIS Resource Center, etc. With the MXD and python window open this is what I've surmised so far. import ...
0
votes
1answer
722 views

Viewing print text while running a script in ArcMap

Why can't I see print text when running a script in ArcMap, but can view it when run in the python window of ArcMap? I have a number of scripts that have a print function but don't show when run from ...