100 likes | 326 Views
Mid-West ESRI Utility Users Group 2010. Geoprocessing with Model Builder and VBScript. Geoprocessing with Model Builder and VBScript. Introduction: Jeff Grussing, Leader of GIS Development for United Services Group (USG). USG is a department of Great River Energy (GRE)
E N D
Mid-West ESRI Utility Users Group 2010 Geoprocessing with Model Builder and VBScript
Geoprocessing with Model Builder and VBScript Introduction: Jeff Grussing, Leader of GIS Development for United Services Group (USG). USG is a department of Great River Energy (GRE) A generation and transmission cooperative based in Maple Grove, MN. USG is a shared services organization and provides engineering consulting services to GRE as well as distribution cooperatives and municipals throughout the United States. I have been developing utility GIS systems for over 20 years 17 have been with USG.
Geoprocessing with Model Builder and VBScript What we will cover: Geoprocessing with Model Builder The modeling environment Building simple models Tying simple models together to create complex ones Exporting models to a script Geoprocessing with VBScript Using a VBScript editor Problems with script exported from Model Builder Adding code to fix the problems and enhance the script Things to consider when automating processes with models and scripts
Geoprocessing with Model Builder The modeling environment: The Model Builder environment can be found in both ArcCatalog and ArcMap. Models can be built in both location and run from both as well. Any of the tools found in ArcToolbox can be used in a model we will see examples of this in the demo portion of the presentation. Building simple models: What I would consider a simple model would be one or one type of geoprocessing functions found in ArcToolbox that are placed in a model and are not tied together and no intermediate data in generated. An example of this would be a model that compresses or compacts a geodatabase or exports from geodatabase to shapefiles.
Geoprocessing with Model Builder Tying models and processes together to create complex models: Models, scripts and geoprocessing functions can be tied together to create data and then modify (intermediated data) to produce the final results. We will take an in-depth look at complex model in the demo portion of the presentation. Exporting models to scripts: Geoprocessing models can be exported to one of three different scripting languages VBScript , Java Script, or Python Script which the environment ships with ArcGIS Desktop. The advantage to using scripts is that you can set them up to run as a scheduled event In the Microsoft Windows environment.
Geoprocessing with VBScript Using a VBScript editor : Exported models can be edited by several different programs depending on the type of script you choose to export. Most can be edited using a text editor like Notepad or WordPad. However I would recommend using a script editor the matches the scripting language you choose. It will help you debug you code and find errors a lot easer. I have chosen to demo VBScript and a VBScript editor in the demo. Problems with models exported from Model Builder: Because you are not actually in an ESRI application some models that are exported from Model Builder may not contain all of the code needed to run outside the desktop environment. There are some setting in the options in ArcMap and ArcCatalog that only work when you in those applications. But the code does exist to make the scripts work out side the desktop environment you just have to add it in.
Geoprocessing with VBScript Adding code to fix problems and enhance the script: Code can be added to the exported model to fill in the holes in the code to make them operate outside of the desktop environment. You can also add code to trap errors, write to logfiles, or pop up message boxes. Things to consider when automating processes with VBScript: If you are running a geoprocessing script it needs to run on a computer that has ESRI installed on it. Certain scripts may require that no users are in the database. Certain Geoprocessing scripts can create schema locks on the database until the are complete. These are just a few bottom line is make sure you are aware of the status of your data before creating or running models or scripts.
Geoprocessing with Model Builder and VBScript Recap: Geoprocessing with Model Builder The modeling environment Building simple models Tying simple models together to create complex ones Exporting models to a script Geoprocessing with VBScript Using a VBScript editor Problems with script exported from Model Builder Adding code to fix the problems and enhance the script Things to consider when automating processes with models and scripts