ModelBuilder Advanced Tutorials

Source: Internet
Author: User

ModelBuilder Advanced Tutorials

by Li Yuanxiang

Modelbuilder Advanced 1 Custom variables

Parameters are used for interoperation, so the parameters have a lot of flexibility, including the definition and invocation of parameters.

In addition to the parameters inside the tool, custom variables can be used to make it very flexible to call in the parameters of the tool.

???? variables include most of ArcMap's objects and data, such as documents, layers, data types, fields, etc., as well as other common variables such as strings, values, etc.

?

The invocation of a variable is generally used to enclose variable names, which can be mixed in parameters.

The following example uses an Administrative code area to create a geodatabase, renaming a string variable to "Administrative Code", and using a combination of strings in the parameters

?

ModelBuilder Advanced 2-Prerequisites

Prerequisites are the conditions that the tool checks first before execution, and if the condition is met, the tool can be executed and the prerequisites are created if they are not satisfied.

The precondition is generally used in the operation without front and back relation, which is different from the front and back parameters;

On the other hand, some ArcGIS operations are performed without preconditions, but are not constrained

Prerequisites are good for enforcing some basic operations before the tool call.

The example uses the creation of a fixed directory as a precondition, so that you can restrict the execution of the tool without a corresponding directory.

?

?

?

Prerequisites can also be used as asynchronous operations

Any variable can be used as a precondition for tool execution, and any tool may have multiple prerequisites.

The example is to first check if there is a corresponding folder, if not, create a directory, and create a geodatabase of symbolic naming rules in the directory.

?

ModelBuilder Advanced 3-iterator

An iteration is a process that repeats several times with some degree of automation, often referred to as a loop. Iterations are important because auto-repeating tasks can save you time and effort to perform this task. When you iterate in ModelBuilder, you can use different settings and data in each iteration to perform the same process over and over again. The iterative operations in ModelBuilder are also flexible, and users can iterate over the entire model or simply repeat a single tool or process.

?

Basically automated operations require an iterator to build the model, and the iterator is the loop operation

The following example uses Shapefile data from administrative divisions to create directories for all counties, and to separate the county boundaries into the directory

?

For loop, perform multiple operations.

Considerations for using Iterators

    • Only one iterator can be used in the same model, and if multiple iterations are required, the model with the iterator could be loaded into another model and iterated
    • There are no conditional selection functions for the data itself in iterators, which can be set up in System tools (such as filtering, filtering, etc.)
    • The types of iterators are limited, but the clever use of iterators can solve problems efficiently.

?

ModelBuilder advanced 4-inline variable

In ModelBuilder, you can use the percent sign (%) Replace the variable with the contents of a variable by replacing it with the one in the same way. This variable substitution method is called inline variable substitution .

The geographic data created in this example is an output variable, but it uses the variable of the administrative code to combine the substitution, then this variable is the inline variable

    • Inline variables can be divided into two categories:
      • Model variable-Any variable in the model:%variable name%.
      • System Variables-ModelBuilder contains two system variables: A%i% that represents the number of a variable list and a%n% that represents the number of iterations of the model.
    • Rules for using inline variables
      • Variable name use percent sign (%) .
      • Spaces are allowed in variable names.
      • Substitution is case-insensitive. Initial value and Initial value are equivalent.
      • When the model is executed, inline variables are determined and used in the following order:
      • Model variables.
      • Model environment settings.
      • System variables (%i% and%n%).
      • The variables in the parent model. If the currently running model is a child model, the variables of its parent model will be searched together.

        ?

ModelBuilder Advanced 6-model-only tools

    • Only model tools are used in ModelBuilder. Some of these tools can be used to control the processing flow, while others are simple support tools.
    • ModelBuilder only provides 7 model-only tools
    • Model-only tools are more like conditional controls, character analysis, and other methods and functions within a programming language
    • Model-only tools can be used for calculations and judgments during model operation

For example, the parse Path tool can well reflect the path of each layer of data

?

ModelBuilder Advanced 5-Tools Help

It is necessary to include appropriate instructions in the tool to facilitate the use of the model

The description of the model can be set in Arccatalog using the right-click "Project description"

ModelBuilder Advanced Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.