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 control over what values are valid as well as extracting unique values from fields.
Going the first route:
Set the data type to string (as shown in your picture) ...
You can see the proj string used by QGIS to transform from and to WGS84 when you look at
Settings->Project settings, CRS tab, and search for the EPSG code or name of a CRS. All CRS are referenced by their EPSG code, or user defined CRS.
Uusally, all EPSG-codes are bundled with one certain transformation to WGS84 which was decided to be most appropriate....
#outfilename=r"C:\" + outbasename + ".txt" # Original with typo
outfilename = "C:\\" + str(outbasename) + ".txt"
this is how I would do it in arcpy in a script tool
You can put the WKT text into a text file, and run gdalsrsinfo on it:
gdalsrsinfo test.txt >out.txt
PROJ.4 : '+proj=lcc +lat_1=26.666667 +lat_2=29.333333 +lat_0=28.002808 +lon_0=84 +x_0=500000 +y_0=500000 +a=6377301.243 +b=6356100.230165384 +units=m +no_defs '
The ellipsoid parameters look very much like Kalianpur 1962, EPSG 4145:
This was a simple question that had found difficult to answer. I searched through the Esri documentation, which is usually very thorough, but just overlooked it. I wanted to share my answer here in a concise manner.
In the Parameters dialog, set up a parameter, and set its direction to "output". Set the type to "Derivative" if applicable.
In the script, ...
You can't hide parameters, but you can enable/disable them through script tool validation. E.g.:
self.params.enabled = True
self.params.enabled = False
Will enable parameter 1 if and only if parameter 0 has a value. This would go in the ToolValidator's updateParameters function.
You're not really supposed to do this, but you could open a cursor in your validator's updateParameters method.
if self.params.value and arcpy.Exists(self.params.value):
value_set = set(row.getValue('COL_NAME')
for row in arcpy.SearchCursor(str(self.params.value))))
self.params.filter.list = sorted(value_set)
If your script is in a Python Toolbox, you can use a Value Table (GPValueTable).
param0 = arcpy.Parameter(
displayName='Elevation and Temperature',
param0.columns = [['Long', ...
Your issue is arising due to the use of a comma as the decimal mark. It may help to understand that in your script you are not converting a double into a float, you are converting a string into a float. The string, when a comma is used as the decimal mark, is invalid.
I would make use of the Replace method here to ensure that a decimal point is used in the ...
Instead of using the Field Calculator tool, a possible workaround is to create a custom script which allows the user to choose an attribute field and update it with a value they enter.
To do this, go to Processing Toolbox > Scripts > Tools > Create new script and copy the following:
##Update field by number=name
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 angle. Originally, they called this ratio the “Vegetation Index” (and another variant, the square-root transformation of the difference-sum ratio, the “Transformed ...
Links to specifications for the various WMS versions are here
and list all standard parameters. Individual vendors have been known to add their own parameters on occasion.
I was able to get the SQL Expression parameter's dialog to populate by setting its Obtained From property to the input Feature Layer parameter I created:
Note that Feature Layer parameters also accept feature classes, e.g. a path to a shapefile or feature class, in addition to the name of a feature layer in the current map document or in the current ...
It looks like the arcpy.SetParameterAsText() function takes two parameters: the parameter index position, and the parameter value. Rather than trying to assign the value to the function you need to provide it as the second parameter.
arcpy.SetParameterAsText(0) = decadesText
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 (these would be connected to a custom script which will contain your formulae). So that when a user clicks on a boolean from the modeler, the script will ...
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 (raising a QgsProcessingException otherwise)
When you are building your model just don't assign a data source to it. Leave it blank. If you need to reset the model just click on the "Validate" button on the model builder toolbar (it's a checkmark) that should reset anything that was holding over from a previous run.
How to access parameters in a script tool using arcpy.GetParameterAsText() is described here.
The way that you tried, arcpy.SetParameterAsText(), is intended for setting output rather than input parameters
Have a look at the os.path namespace for common pathname manipulations. I would also parameterize the input file and output locations instead of hardcoding them but of course that's up to you.
I would do something like this:
import arcpy, os, shutil
inputfile = arcpy.GetParameterAsText(0)
ext = os.path.splitext(inputfile) # returns file extension, e.g. "...
Try replacing this:
Ausrichtung = float(arcpy.GetParameterAsText(9))
if Ausrichtung == '#' or not Ausrichtung:
Ausrichtung = "0.0"
Ausrichtung = arcpy.GetParameterAsText(9) # do not float() until you know it's numeric
if Ausrichtung == '#' or not Ausrichtung:
Ausrichtung = 0.0 # a float, ...
You have to get the mxd parameter in the Python code as a string first and then create an ArcMap document object. In the script tool properties, you can still use the parameters data type you've specified, but you cannot pass directly this object to the arcpy code.
mxd = arcpy.GetParameterAsText(0)
mxd_doc = arcpy.mapping.MapDocument(mxd) #create an ...