20
9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor-intensive sequence of steps. Automating a GIS makes it possible to do much more comprehensive modeling than manually going through these steps. It becomes possible to construct a dynamic model, then generate and evaluate a range of possible scenarios in a way that is very difficult when using the GIS interactively. ArcObjects allows you to automate most processes within ArcGIS in a flexible way, greatly expanding the available kinds of analyses.

9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Embed Size (px)

Citation preview

Page 1: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

9. Introduction to ArcObjects

Most GIS analysis carried out within a GIS consists of a labor-intensive sequence of steps.

Automating a GIS makes it possible to do much more comprehensive modeling than manually going through these steps.

It becomes possible to construct a dynamic model, then generate and evaluate a range of possible scenarios in a way that is very difficult when using the GIS interactively.

ArcObjects allows you to automate most processes within ArcGIS in a flexible way, greatly expanding the available kinds of analyses.

Page 2: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

The ESRI product nomenclature can be somewhat confusing. As background, here is is a list:

ArcGIS Desktop – the collection of ESRI desktop applications.

ArcView — Provides comprehensive mapping and analysis tools along with simple editing and geoprocessing.

ArcEditor — Includes advanced editing capabilities for shapefiles and geodatabases in addition to the full functionality of ArcView.

ArcInfo — Builds on the functionality of ArcEditor with advanced geoprocessing. It also includes the legacy applications for ArcInfo Workstation.

ArcMap — ArcMap is the central application in ArcGIS Desktop. It is the GIS application used for all map-based tasks, including cartography, map analysis, and editing.

ArcCatalog — The ArcCatalog application helps you organize and manage all of your GIS information (maps, globes, datasets, models, metadata, services, and so on).

ArcObjects — ArcObjects provides an infrastructure for application development and customization, and is most of what we will be dealing with with programming usiing ESRI’s tools.

Spatial Analyist, Network Analyst, 3DAnalyst, and other toolbox extensions can also be accessed from within ArcObjects.

Introduction to ArcObjects

Page 3: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

ArcObjects is a set of classes and objects designed for automating ArcGIS Desktop applications.

It is a set of building blocks, and is also used by ArcMap and ArcCatalog.

It is part of a set of code libraries published by ESRI.

It works with C#, VB, and other Windows-based languages/environments.

Basic information about the ArcObjects Library is available at: http://edndoc.esri.com/arcobjects/9.2/welcome.htm, under “ArcObjects Library Reference”.

For additional help and reference material, go to http://edn.esri.com/.

Page 4: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

ArcGIS Engine – Makes it possible to embed ArcObjects into other Windows applications or

“Developer Components.”

ArcGIS Server – Offers similar services, but is run by remote clients, such as web browsers. Built to run in a non-visual server environment.

Page 5: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

Other ESRI development tools include Java interfaces for ArcGIS Engine and ArcGIS Server (not desktop); ArcWeb services, which let applications use services provided by ESRI remotely; ArcSDE for database integration; and ArcIMS for web-server-based applications. More information...

ArcGIS Desktop – For applications that control ArcGIS, or extensions to be included within ArcGIS such as marcros or toolbox extensions. Allows full

interaction with ArcGIS user interface. ArcGIS Desktop is what we will be using in class.

Page 6: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

ArcObjects was built in C++ using a technology called COM, or Component Object Model. COM is a predecessor to .NET, and is focused on allowing applications to embed components or other applications.

One of the key features of .NET is Managed Code, that is, code that is garbage-collected by the .NET runtime environment, and that interacts with the system only through .NET interfaces. Unmanaged code interacts with the system directly.

ArcObjects are built on Unmanaged code; there is a layer within the .NET libraries that manage communication between these two environments.

That means that there is some extra overhead to each call from C# into the ArcObjects library.

More information...

Page 7: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

Page 8: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

Within ArcObjects Desktop development environment, the main kinds of software you can develop are:

Custom simple commands that can be run from within ArcGIS.

More complex toolbox plugins with their own user interfaces that can also be run from within ArcGIS.

Applications that launch and control ArcGIS , accessing ArcGIS functionality from an external process.

Embedding ArcGIS functionality within a separate stand-alone application requires ArcEngine.

Page 9: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

Simple custom

tool example:

Page 10: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Introduction to ArcObjects

More complex

ArcMap Extension:

Page 11: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

ArcObjects Library

The most direct way to use ArcObjects from within C# is to control ArcGIS from an external application, which runs ArcGIS and controls it using the ArcObjects interfaces.

This is the approach we will use in class.

To get an initial idea of the ArcObjects environment and documentation, we can look at the now-familiar Geometry classes.

The next slide first displays the ESRI diagramming conventions.

Page 12: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible
Page 13: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible
Page 14: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible
Page 15: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

ArcObjects Library

The ArcObjects library is quite large, with hundreds of classes documented by pages and pages of class diagrams.

Geometry objects are found within a more complicated context than Geotools. You have to go through a few layers to get to the actual geometry of a map.

The main organizing objects are:

• Application – A representation of the running application

• Document – A map document

• Map – A map within a document

• Layer – A layer within a map

Page 16: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Application

ArcObjects

Page 17: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Document

ArcObjects

Page 18: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

Layer

ArcObjects

Page 19: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

ArcObjects

Map

Page 20: 9. Introduction to ArcObjects Most GIS analysis carried out within a GIS consists of a labor- intensive sequence of steps. Automating a GIS makes it possible

ArcObjects

The overall sequence of automating ArcMap from an external

application is:

1. Launch ArcMap 2. Open map document file3. Get a reference to the map within the document4. Retrieve the layers from the map5. …. Read/write from the map layer ….6. Close/save the document7. Quit ArcMap

ArcObjects allows you to automate most processes within ArcMap.