Technical Workshops ModelBuilder Advanced Techniques Scott Murray How to become proficient at building models? • Know how to use Geoprocessing tools - Complex operations are accomplished by combining simple operations - An introduction to the commonly used GIS tools - Geoprocessing Model and Script Tool Gallery • Know ModelBuilder Techniques - Iteration - In-line variables - Model only tools - Control the flow of model with preconditions ArcGIS Online Help Professional Library Geoprocessing Book Geoprocessing with ModelBuilder Model Iteration • Repeat the same set of operations • For example: process all feature classes in a workspace Model Iterators Types of iterators • For: a fixed number of times • While: until a condition is reached • Feature Selection: for each feature in a feature class • Row Selection: for each row in a table • Field Value: for each value in a table • Multi-value: enter values to iterate • Dataset: for each dataset in a workspace • Feature Class: for each feature class in a workspace • Files: for each file in a folder • Rasters: for each raster in a workspace • Tables: for each table in a workspace • Workspaces: for each workspace in a folder Model Iteration Round 1 Model Iteration Key Points • The entire model runs for each iteration - Only include the things you want run every time in the model - Use models and sub-models to separate what runs once and what runs for each iteration • A model may only have one iterator - Use sub-models to combine iterators • Use Collect Values to pass a list of values back to calling model. Model Iteration Key Points • Use the name and value variables as in-line variables in pathnames and equations. • Dataset iterators can be recursive - Be careful • Feature, Row, and Value iterators can be each row or grouped by rows with the same field value. • Use Iterate Multi-value to iterate over values selected by browsing for datasets or typing is a set of values. - Iterate Multi-value replaces Series and Lists (9.3) In-line variable substitution • Use to make parameter values more flexible In-line variable substitution • Any string or path parameter can include in- line variables • Use %<keyword>% to indicate in-line variable • Keywords: - Variable Names - Environment setting names - Built in keywords - %n% is the current iteration number In-line variable substitution examples • Select expression - [airport_id] = ‘%airport_id%’ - Makesure to include quotes in the expression if needed!!!!! • Calculate Field expression - !shape.Area! * %conversion_factor% • Path to dataset - %scratchworkspace%\out.shp - Directory\out%n% Model Only Tools Useful utility functions in ModelBuilder Model Only Tools: Calculate Value • Any Python expression • Can supply a code block for complex logic • Can set any output data type - Useful for transforming strings into any data type Model Only Tools: Select Data • Use to expose sub-datasets from the results of tools like Solve, Import from CAD Model Only Tools • Collect Values - Use to collect values in an iterative model - Use to combine 2 multi-values into one - Use to convert a list to a multi-value • Get Field Value - Use to get a single value from a table • Merge Branch - Useto bring multiple processing branches back together Model Only Tools • Parse path to parse the path and file from full path - Use names • Stop - Use to stop an iterative model. - Similar to While - Can be combined with an iterator - Example: Run 10 times or until some condition is true. Model Iteration Round 2 Managing model tool parameters • Variable Name = Parameter Label/Name • Variable Data Type = Parameter Data Type • You can change “Optional” to “Required” • You can specify a filter • You can specify output symbology Parameter Filter • Various filters based on data type - String: specify a choice list - Feature class: specify the geometry type: Point, Line, Polygon, … Parameter Symbology • Set the symbology property on the output variable Parameter Symbology • The layer file defines the symbology that will be used when a layer is created for the output geodataset • Classified legends will update if the classification type is not “manual” • Unique value legends will update if “all other values” is false Turning a model into a tool Making the model input interactive • Use the Feature set data type to create a model where the user draws the input on the map - Feature class defines the feature type and attribute - Layer file defines the symbology Precondition can be used to control the order of processing Precondition can be used for if/then branches in a model Pre-condition used to determine which branch execute Calculate Value is used to determine true/false conditions Merge Branch is used to bring the branches back together If/Then Example Import Metadata and Update Metadata Unlisted Session • Python Scripting for Map Automation in ArcGIS 10 - Tuesday at 1:30 - 2:45, Room 8 - Friday at 9:00 - 10:15, Room 11B.
Pages to are hidden for
"ModelBuilder Advanced Techniques"Please download to view full document