Customizing ArcGIS Spring 2008 1 GISC 6382 Applied GIS UT-Dallas Briggs Customization in ARCGIS Two levels of Customization • Customizing the Interface – To create more efficient user interfaces • For yourself (e.g. grouping frequently used tools) • For specialized applications (e.g. simplified interface for data entry operators) – To access capabilities not on the standard interface • Supplied as part of ArcGIS but not on the standard interface (many!) • Downloaded from the web – From ESRI web site, supplied by ESRI or users – From other web sites • Developed by you • Developing Additional Capabilities – Automating repetitive tasks – Creating new analytical procedures Our focus here will be on customizing the interface. GIS 5317 Programming for GIS will focus on developing additional capabilities. 2 GISC 6382 Applied GIS UT-Dallas Briggs Options for Developing Additional Capabilities Current Generation—ESRI ARCGIS • Modelbuilder – Multi-step, sequential processing of ArcTools, using a visual development environment which comes as part of ArcGIS • Python, Jscript and VBScript – standardized and relatively simple scripting languages for repetitive processing, including loops and decision trees, using ArcTools – Python scripts can be generated from Modelbuilder • Visual Basic for Applications – Permits writing of VB macros for sophisticated customization and development within standard ArcGIS (ArcMap/ArcCatalog) interface (and thus requires license for these) – may incorporate ArcObjects, the COM compliant software objects out of which ArcGIS is constructed. • ArcGIS Engine – Set of embeddable GIS components (ArcObjects software objects) for use in building custom applications, independent of ArcGIS interface – Runs under Windows, Unix and Linux, with support for Java, C++, COM and .NET 3 GISC 6382 Applied GIS UT-Dallas Briggs Options for Developing Additional Capabilities Earlier Generations: ESRI • MapObjects – Microsoft COM compliant objects used to incorporate geographic capability in standard IT applications, introduced around 1997 – Replaced by ArcEngine/ArcObjects • Avenue – The proprietary object oriented programming language used for ESRI’s first GUI based product, ArcVIEW, introduced in 1993, – Not compatible with ArcGIS 8 or 9 – Most Avenue-based applications have now been replaced with ArcGIS 8/9 equivalents • AMLs: Arc Macro Language – The scripting language associated with ESRI’s original ArcInfo product introduced in 1981 – Can still be run within ArcGIS 9 via: • ArcInfo Workstation interface • Via a tool on a toolbar in Arc Map or ArcCatalog 4 GISC 6382 Applied GIS UT-Dallas Briggs Options for Developing Additional Capabilities Current Generation—non-ESRI • Other major GIS software vendors have equivalents to ArcEngine e.g. MapInfo MapX • TatukGIS specializes in providing GIS software component objects (and there are others) – http://www.tatukgis.com/ • Google Map and Google Earth mashups, combining your own data and applications with Google Map or Google Earth using kml scripts (keyhole markup language) – http://magellan.utdallas.edu/biomap/ 5 GISC 6382 Applied GIS UT-Dallas Briggs Customization Dialog Box • A graphic interface for customization. To open – Go to Tools>Customization – Or, double click on empty area in a toolbar • Modify user interface – – – – Turn toolbars on and off Create new toolbars Create new controls Add, delete, and move controls (buttons and menus) – Manage shortcut keys 6 GISC 6382 Applied GIS UT-Dallas Briggs Creating a new tool bar • Organize related controls • Name the toolbar • Drag commands, controls, or macros onto (off) the toolbar 7 GISC 6382 Applied GIS UT-Dallas Briggs Creating a Menu • New Menu and Menu Items 8 GISC 6382 Applied GIS UT-Dallas Briggs Adding commands to context menus • • Add the context Menu toolbar Drag commands onto the context menu 9 GISC 6382 Applied GIS UT-Dallas Briggs Shortcut Keys • Keyboard button in the customize dialog • Change the shortcut key for any command 10 GISC 6382 Applied GIS UT-Dallas Briggs UI Controls • User Interface (UI) Controls – UIButtons, UItools, UIEditBoxs, and UIComboBoxes • Control Properties – – – – Text or no text Image Caption Group 11 GISC 6382 Applied GIS UT-Dallas Briggs Visual Basic Editor • Tools> Macros> Visual Basic Editor • View Source 12 GISC 6382 Applied GIS UT-Dallas Briggs ToolTips • Help for your controls • Set the Tooltip property • Help message in the status bar (Message) 13 GISC 6382 Applied GIS UT-Dallas Briggs Save Customizations • ArcMap has three level of storage – Normal Template (Normal.mxt): Affect all documents – Template (MyTemp.mxt): Affects all documents using this template – This Document (Myproject.mxd): Affects this document only • ArcCatalog only uses a normal template 14 GISC 6382 Applied GIS UT-Dallas Briggs Examples • Code for Fixed Zoom-In • What about Fixed Zoom-out Dim pDoc As IMxDocument Dim pEnv As IEnvelope Set pDoc = ThisDocument Set pEnv = pDoc.ActiveView.Extent pEnv.Expand 0.5, 0.5, True pDoc.ActivatedView.Extent = pEnv pDoc.ActivatedView.Refresh 15 GISC 6382 Applied GIS UT-Dallas Briggs AMLs: Arc Macro Language • The scripting language associated with ESRI’s original ArcInfo product • Essentially allows ArcInfo commands to be saved in a text file and then executed in batch • Based on the operating system for the Prime minicomputer of the 1970s • Conceptually similar to the old DOS .bat files • Was the only way to be productive in ArcInfo version 7 and earlier! • Many AMLs still exist and need to be converted • Still runs in Workstation ArcInfo • ArcCatalog will generate and save AML scripts • With the introduction of scripting capabilities in ArcGIS 9.0, AMLs no longer useful – Most AML capabilities can be re-created with python script. 16 GISC 6382 Applied GIS UT-Dallas Briggs Running an AML in ArcGis Workstation • • Initiate an ArcGIS Workstation session If necessary, use the CREATWWORKSPACE command to create a workspace – • Use the command WORKSPACE to move into the new workspace – • &TERM 9999 DISPLAY 9999 &ECHO &ON (directs AML output to your terminal) (directs any graphic output to terminal—not needed here) (sends debug info to terminal—turn off with &OFF) &RUN utd_newtin.aml After AML finishes, check that AML tasks completed successfully, e.g. use the DIRECTORY TIN command to list TINs created – • Use Explorer to copy p:\data\p6382\exercises\custom\utd_newtin.aml Use Wordpad to specify appropriate directory for CREATETIN command Run the AML with the &RUN command – • c:\usr\ini\custom Establish the necessary environment for running an AML – – – • w Use a standard text processor (e.g. Wordpad) to create/edit your AML and be sure it is saved as a text file with the extension of .aml (place double quotes around name in save box e.g. “newaml.aml”) – – • cw c:\usr\ini\custom DIR TIN For practice, run the AML: giscity.aml – Issue the command END in the Arc window to close the graphic window. 17 GISC 6382 Applied GIS UT-Dallas Briggs