Variables

Variables are used in models to store data connection info and can support various types: including files, data sources, strings, numbers, dates, etc. In model construction, adding variables as parameters for other tools is supported. A variable can be connected to multiple tools, simplifying the processing flow and making the model easier to view and understand.

For example, when building a terrain suitability analysis model, it is necessary to perform slope analysis, slope aspect analysis, and algebraic operation on DEM Data to analyze the suitability of land development and utilization. To allow users to modify the input data based on their needs, a variable of type raster dataset can be created, with the variable title changed to terrain data, serving as a global variable for multiple tools.

Additional Properties

To enhance usability, additional properties have been added to variables to achieve fine-grained control over parameters and to combine with inline variable substitution. Specific applications are as follows:

  1. During data interaction, select the appropriate variable type based on the specific situation. For the additional properties corresponding to different types of variables, refer to the appendix at the end of the document. Based on different additional properties, different user interfaces are provided for operation. For example, when importing road shp data as a source of data, a string-type variable can be created, with the additional property setting set to file path, and the data type input as shp. When selecting data in the user interface, only shp files are filtered through the file selector for road data selection.

  2. Support inline variable substitution. A complete inline variable substitution needs to be enclosed with '%', with '#' followed by selecting available attributes. Different additional properties will result in different available attributes after '#'. During batch data import, to ensure that the result names are consistent with the input data names, create a variable of type string collection and set the additional property to file path. Then, use fileName in the inline variable to obtain the file name, and input %sourceFilePath#fileName% to replace the output result data name.

  3. Combine with conditional filtering, supporting connecting variables as pre-conditions. Different condition types can be set based on the variable's additional property settings. When it is necessary to determine whether a data source exists, create a string-type variable, set the additional property to connection info, and the condition setting can be selected as data source.

Usage Scenarios

  • Can be combined with inline variable substitution

    When batch processing of datasets is required, it can be combined with inline variable substitution to standardize the naming of batch data processing results. During batch data buffer analysis, create the variable as a vector dataset collection, use the model for iteration, and create buffer output results each iteration. To ensure that the output resulting dataset name matches the input dataset name, the input data set names can be used as inline variables to replace the output result data names.

  • Variables support creating collection data

Variables support creating collection data, allowing batch settings of multiple data. As in the model below, buffer analysis needs to be performed on three data in a certain area. Create a collection variable of type vector dataset, add three vector datasets respectively; set the buffer distance as a numeric variable, with the three distances set to 50, 100, and 150 respectively.

Operation Instructions

  • iDesktopX: Through the "gpa" tab, double-click the variable in the dropdown menu of the "Variables" group to add the variable to the canvas for use.
  • iServer: Enter the gpa service modeling page, switch the toolbar to the variable bar, and drag the required variable to the canvas.

Create Variable:

1. Select the required variable type to create an empty variable.

  • Additional Properties: Select the additional attributes corresponding to the data type.

  • Collection: Choose whether to create the variable as a collection of multiple values. If the collection option is checked, multiple data can be set in the tool's properties panel via the "Add" button.

2. Open the variable tool's properties panel to add data to the empty variable.

  • ID: The ID is the unique identifier of the variable and cannot duplicate other variable IDs.

  • Title: Supports modifying the variable title for easy viewing and understanding of the data.

Appendix - Additional Properties Corresponding to Different Types of Variables

1. String

  • File Path
Name Description Available Values
File Type Set the type of the target. Directory indicates a file catalog, file indicates a file. directory, file
Mode Set the operation mode of the target file. Select means selecting an existing file; create means creating a new file. select, create
Data Type Set predefined groups or file extensions, supporting multiple values separated by English commas. When set to a predefined group, it indicates support for a certain type of data. For example: sdx, jpg, png.
Detailed description of all predefined groups and their corresponding suffixes:
simpleJson: meta, json
sdx: udb, udbx
tif: tif, tiff
tiff: 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, pix
workspace: smwu, sxwu.
Unrestricted
Attributes Attributes supported by inline variable substitution. fileName (file name), fileExtension (extension)
  • Connection Info
Name Description Available Values
Mode Set the operation mode of the target file. select, create
Target Set the target that the connection info needs to operate on. datasource, dataset
Key Set the key for encrypted saving to the model file. Unrestricted
  • Field
Name Description Available Values
Supportive Type Supported types, supporting multiple values separated by English commas. BOOLEAN, BYTE, INT16, INT32, INT64, SINGLE, DOUBLE, DATETIME, DATE, TIME, TEXT, CHAR, WTEXT, JSONB
Attributes Attributes supported by inline variable substitution. name (name), caption (field alias), type (type)

2. Numeric

Name Description Available Values
Maximum Value The maximum value. Unrestricted
Minimum Value The minimum value. Unrestricted
Left Interval Set the left interval as open or closed. open, close
Right Interval Set the right interval as open or closed. open, close
Attributes Attributes supported by inline variable substitution. hex (hexadecimal), octal (octal), binary (binary), round (rounding), ceil (round up), floor (round down)

3. Vector Dataset

Name Description Available Values
Supportive Type Set the supported vector dataset types, supporting multiple values separated by English commas. All vector dataset types such as point, line, polygon
Attributes Attributes supported by inline variable substitution. name (name), datasetType (dataset type), encodeType (encode type), bounds (bounds), datasource (data source), prjCoordSys (projection system), fieldCount (field count), recordCount (record count), charset (character set), spatialIndexType (index type)

4. Date

Name Description Available Values
Get a Date Instantly Set whether to get the current date instantly. True means get a date instantly, false means preset date. true, false

5. Two-Dimensional Array Matrix

Name Description Available Values
Element Type Set the type of elements. Unrestricted
Matrix Type Set the matrix type. Normal indicates a regular matrix, square indicates a square matrix with the same number of rows and columns, grid indicates a square grid matrix with side length 2*n-1. normal, square, grid

6. Enumeration Type

Name Description Available Values
Available Values Set the value range of the specified enumeration variable. Available values are separated by English commas. Can only be set to the available values of the specified enumeration, such as: Monday, Tuesday, Wednesday