Skip to main content
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 ...
Sethdd's user avatar
  • 526
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 ...
whyzar's user avatar
  • 12.1k
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 ...
user2856's user avatar
  • 69.6k
7 votes
Accepted

How to set .gdb as Python script tool parameter?

The parameter you need is: workspace
T. Wayne Whitley's user avatar
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 (...
ndawson's user avatar
  • 27.9k
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 === ...
Kuik's user avatar
  • 10.1k
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 ...
user2856's user avatar
  • 69.6k
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 ...
Aaron's user avatar
  • 51.8k
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["...
Spacedman's user avatar
  • 66.5k
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:
nielsgerrits's user avatar
  • 3,956
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 ...
PolyGeo's user avatar
  • 65.4k
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( ...
Joseph's user avatar
  • 76.3k
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", ...
Mark Bryant's user avatar
  • 1,445
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 ...
gotchula's user avatar
  • 3,193
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(...
Ben W's user avatar
  • 23.1k
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.
KHibma's user avatar
  • 17k
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 ...
Joseph's user avatar
  • 76.3k
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))
artwork21's user avatar
  • 35.2k
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, ...
Soalpa's user avatar
  • 193
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 ...
Hayden Wilson's user avatar
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 ...
mmoore's user avatar
  • 1,011
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]" ...
Kadir Şahbaz's user avatar
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] # ...
Paul's user avatar
  • 11.6k
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 ...
nicholasericksen's user avatar
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 ...
mikewatt's user avatar
  • 5,188
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, ...
Hanne's user avatar
  • 56
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. ...
Alex Tereshenkov's user avatar
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 ...
mkennedy's user avatar
  • 19.1k
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. ...
Mattropolis's user avatar
  • 1,674
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 ...
Andre Silva's user avatar
  • 10.3k

Only top scored, non community-wiki answers of a minimum length are eligible