Questions tagged [python-script-tool]
Python Script Tools are added to standard toolboxes (*.tbx) of ArcGIS for Desktop
449
questions
1
vote
0
answers
32
views
Clipping Polygons and creating a new polygon as a feature
I am doing a task using the ArcPy module in ArcGIS Pro. The task is to Clip a polygon feature class with another polygon feature class and return the remaining polygons as a new feature class. I have ...
0
votes
1
answer
28
views
Iterate through fishnet polygons for extents and update field
I am new to Python.
I'm creating a Script Tool in 10.8.2 that generates polygons from Create Fishnet of 1 deg x 1 deg and a new field GEOCELL. I need to update field GEOCELL with the lower left corner ...
1
vote
1
answer
38
views
Implement Script Tool with ModelBuilder as GeoProcessing Service
I built a model in ArcGIS Desktop 10.8.1 and want to implement a script tool at the end (inside the model).
All elements are using relative paths and %SCRATCHWORKSPACE%\ in the file paths (as ...
0
votes
0
answers
23
views
Custom ArcPy tools not working after upgrading from ArcMap 10.7 to 10.8.2 [duplicate]
After updating ArcMap from 10.7 to 10.8 none of my custom ArcPy tools are working now. There is a red X by my input with no visible error upon hovering over, and when I run the tool I get a blank ...
0
votes
0
answers
34
views
How to export shp and TIFF files from a list with Python
I'm a beginner in Python, and I am trying to write code that receives a list of TIFFs and shapefiles from an input folder.
The objective is:
Do a clip to a raster using the Extract By Mask and if the ...
3
votes
1
answer
246
views
Arcpy Traceback error 000210: Cannot create output
I have been given the task of taking a script that was made by someone who has left and altering where it saves the files. This is originally a simple folder system but we are moving over to file ...
1
vote
1
answer
76
views
Creating a Multi-Step Spatial Join Tool Script (One point file to many polygons) with one point output
I am wanting to create a ArcPy Tool Script that will join a point file to multiple polygons. Ideally, the point file (input_fc) would be a parameter so it can be interchangeable. Then the polygons ...
-1
votes
2
answers
44
views
Adding text in Tool Help of Python script tool
How do I add some text in the section "Tool help" in a Script tool?
I leave a screenshot in case there are doubts about what I mean:
0
votes
0
answers
44
views
Create geoprocessing tool using ArcPy that buffers multiple inputs and then merges and dissolves them into one final output
I am trying to create a geoprocessing tool in ArcMap by way of Python that will accept multiple inputs (points, lines, and polygons) buffer them based on user input, and then take the results and ...
0
votes
0
answers
59
views
Difference plugin vs processing QGIS script GUI
I would like to know if there is a way to build a processing provider script having the same abilities as in plugins under 'tool button with dialog' & 'tool button with dock widget' considering ...
1
vote
0
answers
24
views
ArcCatalog - Script - Parameter - Choose a previous one
I am working on a script that automates the following process: from coordinates in excel spreadsheet to a map in mxd or kmz.
Because the set of coordinates are in two different zones, I have to ...
0
votes
0
answers
79
views
How to specify Python Executable file as Interpreter ArcGIS Pro Custom Script Tool
I am converting a stand-alone script to a ArcGIS Pro custom script tool. When I run the script, everything runs according to plan, however I get an error when I run it as a tool.
AttributeError: ...
3
votes
1
answer
51
views
ArcMap tool dialog says relative paths are incorrect
I have ArcMap 10.7.1 and I have created a Python script tool and tool dialog to run on it.
I want to set a default value for one of my inputs on the tool dialog and have it be a relative path to a ...
1
vote
2
answers
49
views
Getting fields from layer calculated during process (output layer) for later calculate field that is parameterized using ArcPy with ArcMap
I'm working in Pycharm Python IDLE under ArcPy, to later work on setting up a toolbox in ArcGIS Desktop 10.7.
I have a large script running in Python that works fine without parameters. Now, I want to ...
0
votes
1
answer
105
views
Run arcpy-script as geoprocessing tool
I am trying to get my first python/arcpy script going, but I am stuck with implementing it into ArcGIS Pro. If my script is running inside the ArcGIS Pro Python-Window everything is executed well and ...
0
votes
0
answers
30
views
Create the loop for multiple raster convert to vector polygon using the arcpy scripting tool
This is my code which works only with the one raster image. But I need to create the tool that converts the multiple raster to vector in loop with arcpy.
import arcpy
from arcpy.sa import *
arcpy.env....
1
vote
1
answer
61
views
Update features based on multiple GetParameterAsText
I am trying to figure out how to update feature attributes by user input parameters (GetParameterAsText). Current script the user inputs a arcpy.GetParameterAsText(can be multiple) then there is a ...
1
vote
1
answer
41
views
arcpy.AddField_management does not work in tool, only in Python Interpreter
I am creating a tool in ArcGIS Pro where a part of the code creates a feature class (low_fuel_warning) and adds fields to it. When running the code in the Jupyter Notebook in ArcGIS, it works as it ...
1
vote
1
answer
62
views
Changing upper break value to decimal using ArcPy with ArcGIS Pro
My ArcGIS Pro custom script tool is based off of a script that changes break values from a user's input. I believe I've done all I can troubleshooting the existing script. I'm suspicious of the tool ...
0
votes
1
answer
56
views
Sharing Python Script Tool gives Error 000576
I'm distributing a Python script tool with folks outside of my organization.
I had always assumed the .tbx file and the script were self contained. But when someone else tried to run the tool, they ...
1
vote
1
answer
34
views
ArcPy - Export to PDF - Script tool - What kind of parameter is a PDF output?
I am making a script to output an export to PDF. However, when parameterizing this function as GetParameterAsText () in the script in ArcCatalog, I don't know what type it is in "Data type".
0
votes
1
answer
42
views
UpdateCursor gives RuntimeError that column does not exist
I have managed to get my previous update cursor to work without any hiccups. All I have done is change the fields the script needs to look for. The error I am getting is:
RuntimeError: A column was ...
-1
votes
1
answer
32
views
Python script tool gives IndentationError in ArcMap
I am trying to use my Python script for Merge in ArcGIS as a tool.
(to use this script in model)
But it occurs an error (below figure).
I don't know what problem is...
Python script : work in ArcGIS ...
0
votes
1
answer
42
views
ArcPy - Script tool to insert shapefile in MXD does not work
The following script has the function of inserting shapefile in an mxd project based on a previous one.
import arcpy
from arcpy import mapping
arcpy.env.workspace = arcpy.GetParameterAsText(0)
...
1
vote
0
answers
28
views
Parameterize script that serves as sub-tool of ModelBuilder of ArcMap
The following script is used to place shapes inside a .mxd project:
import arcpy
from arcpy import mapping
arcpy.env.workspace = r"C:\GIS\Test"
mxd = arcpy.mapping.MapDocument(r"C:\GIS\...
0
votes
0
answers
73
views
Graduated Colors Renderer Script to Script Tool
The script I have works fine as a standalone. But, I'm seeking some help making the script tool function correctly in ArcGIS Pro. Currently, it runs without error, but it seems like the color ramp, ...
0
votes
1
answer
71
views
Invalid syntax on arcpy.conversion.FeatureClasstoFeatureClass()
I am using ArcGIS Pro 2.8.1.
In a Python script tool, I am trying to get a list of feature classes as an user supplied input parameter, and export all of them with an additional text string that is ...
0
votes
1
answer
74
views
How to add user input shapefile as a parameter into "GDB Creator" Python Script tool
I created a Python Script tool to create a GDB inside of a user defined folder path. I am trying to find a way to add another parameter in my script tool for a user to input a shapefile after they ...
0
votes
0
answers
339
views
ArcMap: ImportError: No module named sklearn.neighbors
I have tried to create my own Kernel Density Estimation tool in ArcMap, but when importing the sklearn.neighbors module I get the following error:
from sklearn.neighbors import KernelDensity
...
1
vote
1
answer
51
views
Output for Python script within ModelBuilder is empty although defined
For a task I have written a python script that gives a Mosaic Dataset as a final output of some processes.
Inside the properties of my script, inside the Parameters I have defined the following:
Label:...
2
votes
2
answers
102
views
Script removes all data from fields when using custom function in Field calculator
I am trying to clear entries in columns using the field calculator but with my current script, it removes all the data from all the rows. Basically, if the Historical column is equal to 'Historical ...
-3
votes
1
answer
49
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 ...
0
votes
1
answer
64
views
Having script tool output data to Contents pane as tool runs
I am learning Python. I have a script that when copied and ran in ArcGIS Pro's Python Window, it works flawlessly as it adds the feature classes to the Contents pane. However, when ran as a script ...
0
votes
1
answer
201
views
Running ArcPy on PyScripter with ArcGIS Pro
Having PyScripter 4.0.0.6 x64 installed with ArcGIS Pro 2.5 I have set the
I have add/set the arcgispro-py3-clone to Python Path like below
but I am still getting this error message
Traceback (most ...
0
votes
0
answers
145
views
Reprojecting script runs without errors in Spyder and ArcGIS Pro script tool but desired outcome is not reached
I am new to Python and am attempting to write a script where the desired spatial reference is found on my Counties.shp and the other feature classes are in other projected coordinate systems.
The code ...
1
vote
0
answers
52
views
Python code error
import arcpy
inputlayer=arcpy.GetParameterAsText(0)
output=arcpy.GetParameterAsText(1)
arcpy.Select_analysis( inputlayer, output,"LAYER = 'Unknown Line Type'")
I am new to Python migrating ...
1
vote
1
answer
99
views
Export multiple attachments per point feature from fgdb using python script
I use the following script for export of attachments from an arcgis fgdb. It is used inside a script tool. I have multiple attachments (relID) for every pointfeature (GLobalID) and I would like to ...
1
vote
1
answer
44
views
How to get a codeblock in a tool?
I wrote a script in ArcGIS Pro Notebook. It runs there perfectly. Now I try to create a tool with the script. ArcGIS has problems to read my "codeblock" in CalculateField correctly. I think ...
0
votes
0
answers
51
views
ArcPy TopoToRaster parameter settings
I'd like to create a script tool to create Topo DEM with TopoToRaster, but the parameters are not valid.
I tried using the help: https://desktop.arcgis.com/en/arcmap/10.6/tools/spatial-analyst-toolbox/...
1
vote
1
answer
376
views
Creating new Python Script tool with ArcGIS Notebooks
I am trying to create a new tool in ArcGIS Pro that is based on a python script written in the Jupyter Notebook interface. I realize I can write the script elsewhere and save it as a *.py file and ...
1
vote
1
answer
37
views
Adding message error box when parameters do not satisfy some conditions
I have 3 parameters in my tool, including para0, para1, para2. These parameters will be the user's inputs. I would like to display a message box if para0>para1 or para1>para2 or para2>para3.
...
2
votes
1
answer
44
views
Getting zmin zmax of a raster parameter in a tool validation in ArcGIS Desktop 10.7 toolbox Python script
I am developing a Python tool (my first one).
The tool has 3 input parameters:
a raster
z min
z max
I am trying to get automatically z min and z max after the user specify the raster using the ...
1
vote
1
answer
59
views
ArcGIS scripting convert FeatureClass to Shapefile with user-defined shapefile name [closed]
I am trying to convert a feature class inside a geodatabase to a shapefile at a location outside of the geodatabase. I am aware that I can use the function arcpy.conversion.FeatureClassToShapefile(...
0
votes
0
answers
61
views
Using python to do a calculation on a set of numbers in a text field separated by commas [duplicate]
Using ArcGIS ArcMap 10.6:
I have a text field in an attribute table that has comma separated values (example: 12,24, 64, 87,29 OR 13, 45, 32,21,34, 45). For this example, I will name this field VALUES....
1
vote
1
answer
252
views
Is Python/ArcPy capable of delimiting strings with commas into different fields, and running a calculation based on those separate columns [closed]
Using ArcGIS ArcMap 10.6:
I have a text field in an attribute table that has comma separated values (example: 12,24, 64, 87,29). For this example, I will name this field VALUES. Please note that ...
2
votes
1
answer
117
views
Convert scripts for processing toolbox
Does anyone know how I can turn this console script into a script that I can integrate into the processing toolbox? I tried a few options, but I don't do very well in python, and I always get stuck.
# ...
2
votes
1
answer
240
views
Removing fields in an exported table using ArcPy [closed]
I am using ArcGIS Desktop 10.6: ArcMap 10.6. ArcPy script within a custom toolbox.
At the end of my script, I want to export the attribute table of a File Geodatabase Feature Class into a .csv file, ...
1
vote
1
answer
209
views
Creating file geodatabases in script tool after specifying path and names as GetParameterAsText
I am trying to create a script tool in ArcGIS Pro that uses 2 clipping feature classes to clip multiple other feature classes and save them to two new geodatabases I create in the script.
I use 6 ...
1
vote
1
answer
34
views
Making vertical spacing between parameters smaller on ArcGIS Script tool dialog
I would like to make space between parameters smaller in ArcGis Script tool. For example, in the image attached I would like to make the distance between two parameter Standard terrain and User ...
0
votes
0
answers
33
views
How to add a save and load button in a Python-addin ArcGIS?
I would like to generate a tool in Python-Addin ArcGIS as the image attached. I also like to generate the save and load button in the tool. My purpose is that when the user chooses the range ...