Programming ArcObject with VBA

1 Comment

This book is designed for ArcGIS users who want to get a quick start on programming
ArcObjects. Both ArcGIS and ArcObjects are products developed and distributed
by Environmental Systems Research Institute Inc. (ESRI), ArcObjects is the development
platform for ArcGIS, a software package for managing geographic information
systems (GIS). Ideally, users should learn ArcObjects before using ArcGIS,
but that is not the case in reality. Users use ArcGIS first through its toolbars and
commands. It is easier to follow the user interface in ArcGIS than to sort out objects,
properties, and methods in code. The topic of ArcObjects usually emerges when
users realize that programming ArcObjects can actually reduce the amount of repetitive
work, streamline the workflow, and even produce functionalities that are not
easily available in ArcGIS.
How can users learn programming ArcObjects efficiently and quickly? Perhaps
surprising to some, the answer is to apply what users already know about ArcGIS
to programming ArcObjects.

This book has fourteen chapters. The first three chapters introduce ArcObjects, programming
basics, and customization. This book adopts Visual Basic for Applications
(VBA) for programming ArcObjects. Because VBA is already embedded within
ArcMap and ArcCatalog, it is convenient for ArcGIS users to program ArcObjects
in VBA. The following summarizes the major topics covered in the first three
• Chapter 1: ArcObjects — Geodatabase, ArcObjects, organization of ArcObjects,
the help sources on ArcObjects, and the Geoprocessing object.
• Chapter 2: Programming Basics — Basic elements, writing code, calling subs and
functions, Visual Basic Editor, and debugging code.
• Chapter 3: Customization of the User Interface — Creating a toolbar with existing
commands, adding a new button and tool, adding a form, and making basic
Chapters 4 through 14 discuss programming ArcObjects for solving common
GIS tasks. Organized around a central theme, each chapter has three parts. The first
part is a quick review of ArcGIS commands on the topic; the second part discusses
objects that are related to the theme; and the third part presents sample macros and
Geoprocessing macros for solving common tasks under the theme. This combination
of ArcGIS commands, ArcObjects, and sample macros can effectively relate the
user’s experience of working with ArcGIS to programming ArcObjects.
The CD that accompanies this book contains 95 sample macros stored in the
VBA_programs folder by chapter. Each sample macro starts with a short description
of its usage and a list of key interfaces and members (properties and methods). These
are followed by the listing and explanation of code. Many macros are divided into
two or more parts to better connect the code lines and their explanation. Stored as
text files, these sample macros can be easily imported to Visual Basic Editor in either
ArcMap or ArcCatalog to view and run.
The companion CD also includes 33 Geoprocessing macros that are new in this
second edition. These macros are stored in the GP_programs folder by chapter. The
Geoprocessing object is a new ArcObjects component that supports the execution of
hundreds of Geoprocessing tools in a scripting language such as VBA or Python. These
tools are the same as in the ArcToolbox application of ArcGIS Desktop. The Geoprocessing
object is a “coarse-grained” object, which is simpler to use than a “fine-grained”
object. Therefore it allows users who do not understand all the details of ArcObjects
to run macros. To separate them from “regular” VBA macros, Geoprocessing macros
are included in “boxes” in Chapters 4 through 7 and in Chapters 9 through 14.
All sample macros in the text have been run successfully in ArcGIS 9.2. The
companion CD contains datasets for the test runs, which are stored by chapter in
the Data folder. Two notes must be made about use of the sample macros. First,
ArcGIS 9.1 or 9.2 is needed to run the macros. Second, the Data folder is coded in
the sample macros as residing on the C drive (for example, c:\data\chap4). If the
folder is stored on a different drive (for example, the G drive), then the path should
be changed (for example, g:\data\chap4) before running the macros.
The following summarizes the major tasks covered in each chapter:
• Chapter 4: Dataset and Layer Management — Add datasets as layers, manage
layers and datasets, and report geographic dataset information.
• Chapter 5: Attribute Data Management — List fields, add or delete fields, calculate
field values, and join and relate tables.
• Chapter 6: Data Conversion — Convert shapefile to geodatabase, convert coverage
to geodatabase and shapefile, perform rasterization and vectorization, and add XY
• Chapter 7: Coordinate Systems — Manipulate on-the-fly projection, define the
coordinate system, perform geographic transformation, and project datasets.
• Chapter 8: Data Display — Display vector data, display raster data, and create a
layout page.
• Chapter 9: Data Exploration — Perform attribute query, perform spatial query,
combine attribute and spatial queries, and derive descriptive statistics.
• Chapter 10: Vector Data Operations — Run buffer, perform overlay, join data by
location, and manipulate features.
• Chapter 11: Raster Data Operations — Manage raster data and perform local,
neighborhood, zonal, and distance measure operations.
• Chapter 12: Terrain Mapping and Analysis — Derive contour, slope, aspect, and
hillshade; perform viewshed analysis; perform watershed analysis; and create and
edit triangulated irregular networks (TIN).
• Chapter 13: Spatial Interpolation — Perform spatial interpolation and compare
interpolation methods.
• Chapter 14: Binary and Index Models — Build binary and index models, both
vector and raster based.

Download File
Password :