Variables are used in the model to store data connection information and can support multiple types, including files, data sources, strings, numerical values, dates, etc. Supporting the addition of variables as parameters for other tools in model construction allows for the connection of one variable to multiple tools, simplifying the processing process and making the model easier to view and understand.
For example, when constructing a terrain suitability analysis model, slope analysis, aspect analysis, and algebraic operations need to be performed on DEM data to analyze the suitability of land development and utilization. In order to facilitate users to modify input data according to their own needs, they can create variables of type raster dataset, change the variable title to terrain data, and provide multiple tools as global variables.
Additional attributes
In order to improve usability, additional attributes have been added to variables to achieve fine-grained control of parameters, as well as in combination with inline variable substitution. The specific applications are as follows:
When conducting data exchange, choose the appropriate variable type based on the specific situation. The additional attributes corresponding to different types of variables can be referred to in the appendix at the end of the article. Different user interfaces are provided for operation based on different additional attributes. For example, when importing road shp data as the data source, you can create a variable of string type, set the additional attribute to the file path, input the data type into shp, and select the data in the user interface by filtering only the shp file through the file selector.
Provide support for inline variable replacement. A complete inline variable replacement needs to be enclosed in '%', followed by the selection of available attributes. Different additional attributes will result in different available attributes after the '#'. When performing batch data warehousing, to ensure that the results are consistent with the input data name, create a variable of string collection type and set the additional attribute as the file path. You can use fileName in the inline variable to obtain the file name, and input% sourceFilePath # fileName% to replace the Output Result data name.
Used in conjunction with conditional filtering, it supports linking variables as prerequisite conditions, and different conditional types can be set based on the additional properties of variables. When it is necessary to determine whether the data source exists, a variable of string type can be created, with additional attributes set as connection information, and conditional parameters can be selected as the data source.
Usage scenario
-Can be used in conjunction with inline variable substitution
When batch processing of the dataset is required, it can be combined with inline variable substitution to standardize the naming of the results of batch data processing. When conducting batch data buffer analysis, variables are created as a collection of vector datasets, and a model is used for iteration. Buffer Output Results are created at each iteration. To ensure that the output Target Dataset Name is consistent with the input dataset name, the input dataset Name can be used as an inline variable to replace the Output Result data name.
- Variable support for creating set data
Variables support the creation of set data, and multiple data can be set in batches. As shown in the following model, it is necessary to perform buffer analysis on the three data in a certain area, create set variables of type vector dataset, and add three vector datasets respectively; Set the buffer distance as a numerical variable and set the three distances to 50, 100, and 150, respectively.
Operating instructions
- IDesktopX: Through the "Processing Automation" tab, double-click a variable in the drop-down menu of the "Variables" group to add it to the canvas for use.
- IServer: Enter the process automation service modeling page, switch the toolbar to the variable bar, and drag the desired variable onto the canvas.
Create variables:
- Select the desired variable type and create an empty variable.
Additional Attribute: Select the additional attribute information corresponding to the data type.
Set: Select whether to create a variable as a set of multiple values, check the set option, and you can use the "Add" button on the tool's property panel to set multiple data.
- Open the property panel of the Variables tool and add data to the empty variable.
-ID: ID is the unique identifier of a variable and cannot be duplicated with other variable IDs. -Title: Supports modifying variable titles, making it easy to view and understand data.
Appendix - Additional attributes corresponding to different types of variables
- String
File Path
Name Description Available Values File Type Set the type of target, where directory represents the file directory and file represents the file directory、file Mode Set the operation mode of the target file, select represents selecting an existing file; Create represents creating a new file select、create Data Type Set a predefined group or filename extension. It supports multiple values separated by commas. When it is set to a predefined group, it means that a certain type of data is supported. For example: sdx, jpg, png< Detailed description of all predefined groups and their corresponding suffixes:
simpleJson: meta, json
sdx: udb, udbx
tif: tif, tiff
tif: tif, tiff
grid (Windows): dem, bil, raw, bsq, bip, b, bin, vrt, grib2, egc
grid (Linux): dem, bil, raw, bsq, bip, b, bin, egc
mosaic: tif, tiff, img, ecw, pic x
workspace: smwu, sxwuUnlimited Properties Supported properties for inline variable substitution FileName, fileExtension Connection information
Name Description Available Values Mode Set the operating mode of the target file select、create Target Object The target object that needs to be operated on to set connection information datasource、dataset Key Set the key for encrypting and saving to the model file Unlimited Fields
Name Description Available Values Supported types Supported field types, supports multiple values, separated by English commas BOOLEAN、BYTE、INT16、INT32、INT64、SINGLE、DOUBLE、DATETIME、DATE、TIME、TEXT、CHAR、WTEXT、JSONB Properties Supported properties for inline variable substitution Name, caption, type
Numerical type
Name Description Available Values Maximum value Maximum value Unlimited Minimum value Minimum value Unlimited Left interval Set the left interval to open or close open、close Right interval Set the right interval to open or close open、close Properties Supported properties for inline variable substitution Hex, octal, binary, round, ceil, floor Vector Dataset
Name Description Available Values Support Type Set the supported vector dataset type, support multiple values, separated by English commas All vector dataset types such as points, lines, faces, etc Properties Supported properties for inline variable substitution Name, datasetType, encodeType, bounds, datasource, prjCoordSys, fieldCount, recordCount, charset, spatialIndexType Date
Name Description Available Values Real time acquisition date Set whether to obtain the current date in real time. True represents the real-time acquisition date, and false represents the preset date true、false 2D array matrix
Name Description Available Values Element Type Set the type of the element Unlimited Matrix Type Set the matrix type, where normal represents a regular matrix, square represents a square matrix with the same number of rows and columns, and grid represents a square grid matrix with a variable length of 2 * n-1 normal、square、grid Enumeration Type
Name Description Available Values Available Values Set the range of values for the specified enumeration variable, with available values separated by commas in English Can only be set to the available values of the specified enumeration, such as Monday, Tuesday, Wensday