15
votes
Accepted
Choosing string from dropdown list rather than typing it into Python script tool?
There are a couple of ways to approach this:
Create a list of filter values in the parameters property.
Create the list in the validation script.
I prefer the second route since you have more ...
8
votes
Accepted
Why is a normalized parameter involving the Green band and Red band not used for Vegetation determination?
The best explanation I came across is this:
the ratio of the difference of the red and infrared radiances over their sum as a means to adjust for or “normalize” the effects of the solar zenith ...
8
votes
Accepted
Creating Checkbox list in Python script tool dialog ArcGIS Pro
Make a parameter with a Data Type = String and Multiple values
enabled
Set Filter to Value List and add your map names:
When you run the tool, you can select individual maps from the dropdown, or ...
7
votes
Accepted
7
votes
Changing parameter values according to other parameter choice in Processing script using QGIS 3?
No, there's no support for this in existing QGIS versions (<= 3.8). You'd need to address this at runtime, and add a check that the evaluated parameter value falls into the acceptable range (...
7
votes
Accepted
Earth Engine create user defined function with default parameters
You can do that easily using:
Besides, yo have some missing brackets and you will have to use number inside the function where you places a.
var myFunction = function(number, power){
if (power === ...
7
votes
Accepted
Python Toolbox - Only update parameter when specific parameter changes
The "arcpy way ™" is to check if parameters[0].altered and not parameters[0].hasBeenValidated:
According to the documentation:
altered
altered is true if the value of a parameter is ...
7
votes
What is benefit of ArcPy function GetParameterAsText?
The summary on the Esri GetParameterAsText documentation states:
Gets the specified parameter as a text string by its index position
from the list of parameters.
Functionally this allows you to ...
7
votes
Explanation of syntax and parameters of a sample UTM projection file
This is a projected coordinate system with this name:
PROJCS["[email protected]",
which is based on a geographic (Earth-based) coordinate system with this name:
GEOGCS["...
6
votes
Accepted
Using timestamp in text format published parameter of FME?
A TimeStamper will create an attribute with yyyymmdd. Next you can fanout on both filename and sheetname:
6
votes
Accepted
arcpy.GetParameterAsText not passing arguments to script?
The code that you have presented is for a Python Toolbox (*.pyt) for which you need to use the Parameter class.
GetParameter() and GetParameterAsText() are only used with Python Script tools in ...
6
votes
Accepted
Sort or add Rank within QGIS 3 model
Your expression needs to be in a string format excluding input parameters.
For example, if you want to reference existing fields inside your modeler without adding an input parameter:
'array_find( ...
6
votes
Accepted
Grouping Parameters in Python Toolbox of ArcGIS Pro
Add a category to the parameters that you want to group.
For example
screen = arcpy.Parameter(
displayName="Ghostscript 'screen' Compression",
name="gsCompress_screen",
...
6
votes
Accepted
Run arcpy-script as geoprocessing tool
with regards to adding layers to the active map, the gp framework logic is like this: once a gp tool completes it's processing (aka: script execution) the gp framework iterates over all output ...
6
votes
Accepted
How to set Folder as Parameter in PyQGIS script?
You can just use QgsProcessingParameterFile and set the behavior to specify an input folder instead of a single file like this:
def initAlgorithm(self, config=None):
self.addParameter(...
5
votes
Accepted
Add all tool parameters at once
If you're referring specifically to the tool right click > make variable > from parameter > X, then no, there is no way to expose them all at once. You need to do them one at a time.
5
votes
Accepted
Selection input for QGIS Processing models
This is more of a workaround as I'm not sure if it's possible at the moment to allow a user to select from a range of string values. Instead, you could use booleans which would represent your formulae ...
5
votes
Accepted
AttributeError when using arcpy.GetParameterAsText()?
The widthcolumn and heightrow variables are string and need to be type integer:
Try:
widthcolumn = int(arcpy.GetParameterAsText(3))
heightrow = int(arcpy.GetParameterAsText(4))
5
votes
Accepted
Choosing parameters for SAGA Wetness Index?
After lots of calculations and experiments I think I can (at least partly) answer my own question:
Suction: according to the source code (Conrad 2014), a suction of 10 is "average", a smaller value, ...
5
votes
arcpy.GetParameterAsText not passing arguments to script?
Using the answer from @PolyGeo my corrected code is as follows:
import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
...
5
votes
Accepted
Python Toolbox Value Table Parameter - getting separate outputs for different column inputs
I was calling my parameter with the line:
target_elements = params[0].valueAsText
I needed to be calling the parameter as a value:
target_elements = params[0].value
This gave a list of values and ...
5
votes
Using shortestpathpointtopoint tool with PyQGIS
For 'START_POINT' parameter (and 'END_POINT' parameter if necessary), use this:
'START_POINT': f"{startlon},{startlat} [EPSG:4326]",
'END_POINT': f"{endlon},{endlat} [EPSG:4326]"
...
4
votes
Accepted
Access python toolbox input parameter - list of excel files
You're on the right track. From the value object returned by .values, you need to extract the actual value. There's a few ways that can be done:
excelList = [v.value for v in parameters[0].values] # ...
4
votes
Why is a normalized parameter involving the Green band and Red band not used for Vegetation determination?
There are numerous Vegetation Indices that have been created in order to understand different biological properties of plants from remotely sensed data. A major indicator of plant health is the amount ...
4
votes
Python Toolbox parameters set up error: Value is Required
Unfortunately the "parameterType" is a read-only property, so you can't just change that parameter from "Required" to "Optional".
You can work around this by setting it to "Optional", then performing ...
4
votes
Accepted
Arcpy Toolbox sending and error message in specific condition
setErrorMessage should be called from updateMessages, not from updateParameters. Check out example 3 on http://pro.arcgis.com/en/pro-app/arcpy/classes/parameter.htm
I don't have your data to test on, ...
4
votes
Accepted
Wildcard for field in arcpy.GetParameterAsText
Unfortunately, the only filter you can set on the parameter of Field data type is the field type, not its name.
In order to achieve the name filtering, you would need to use a custom validator.
...
4
votes
Lambert Conformal Conic (One Standard Parallel) - Choosing 'Latitude of Origin/Standard Parallel'
The latitude of origin parameter is not a standard parallel. In a two-standard-parallel case of Lambert conformal conic, it is used to identify the origin of the northing / Y-coordinates only.
In ...
4
votes
Accepted
Using less parameters for Python script tool?
To make it easier for the user, create a default value for all parameters, then the user can just hit the OK button.
In the script tool properties, create a default value for all of the parameters. ...
4
votes
Setting GroundFilter parameters for low density point clouds?
The most suitable alternative (if default settings do not work) is to simulate combinations of GroundFilter parameters until the best result is achieved. It is important to have real accurate data to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
parameters × 362arcpy × 206
python-script-tool × 69
arcgis-desktop × 61
python-toolbox × 61
modelbuilder × 53
arcgis-pro × 31
qgis × 29
arcmap × 28
coordinate-system × 22
tool-validation × 20
arcgis-10.3 × 14
python × 13
arcgis-10.2 × 12
pyqgis × 10
geoserver × 10
qgis-3 × 10
wms × 10
arcgis-10.1 × 9
sql × 9
qgis-modeler × 9
multi-values × 9
select-by-attribute × 8
raster × 7
fields-attributes × 7