ArcObjects

From Wildsong
Jump to navigationJump to search

Some ArcObjects projects that I am developing.

Getting off the ground

The first time is the hardest... even just knowing where to start.

I am using Visual Studio 2005 + ArcGIS Desktop 9.2 and programming in C#.

For someone conversant in C# and Visual Studio, it's hard because the only book I can find is "Getting To Know ArcObjects" which spends the first 1/2 of its content telling you how to drop an icon into a toolbar. Then it spends the second 1/2 on Visual Basic examples that don't interest me.

What I was looking for was a wedge to drive into ArcObjects to split it open. "Getting To Know ArcObjects" was a major disappointment. Good thing I borrowed it from the library so I did not have to waste my own money on it.

Developer samples are helpful

Next I spent some time exploring the sample code buried in my development system at C:/Program Files/ArcGIS/DeveloperKit/SamplesNET/Desktop There are lots of C# samples. Too many in fact - they are all sort of just dropped into the directory with long names like "NAServerGeocodeRouteWebService" and little documentation. Dear ESRI: a table of contents would have been SO USEFUL.

The Developer Samples are not a wedge either. More of a deluge. You still have to know something to get started.

EDN works for me

Finally I found a useful document on EDN, the ESRI Developer Network site.

The page that got me running was this one: (Great name, huh?) http://edndoc.esri.com/arcobjects/9.2/NET/01c01659-cdf8-4579-9c87-2b965e872d84.htm

I have successfully built a sample command and run it in the debugger. It just lists out the names of every layer in the current map in a Windows Form Listbox. I am now well on my way with my first project, which will be a "project publisher" for ArcReader.

Code snippets are really handy

The best tip from the above-mentioned EDN doc is to use the "code snippets" feature in Visual Studio to tap into the code provided with the developer kit. They are a big help!

ArcReader Project publisher

As a tool within ArcMap

Read the currently open MXD file and publish the map as a PMF file. Then generate a manifest for a map containing a listing of all files required to reproduce it. This file should be usable by an external Python script to copy the files to a distributable cdrom as an ArcReader project.

If there are any unmanaged raster catalogs then include the list of rasters.

Report any problems such as layers that will not be reachable (outside the current directory tree.)

It might be interesting to embed the Python in the output so the manifest is runnable.

As a command (runnable from Python scripts)

http://edndoc.esri.com/arcobjects/9.2/NET/0D300185-2025-4FA9-A4FF-FEBD0FE4C298.htm

Other relevant pages

Windows programming

Mapbook

The client wants to be able to export a series of maps to PDF's using a column of data from a table on each map; if you change the extent of the map and click print it creates a new series.

Starting point

DS_mapbook from the developer samples

http://edndoc.esri.com/arcobjects/9.2/CPP_VB6_VBA_VCPP_Doc/COM_Samples_Docs/Cartography/Map_Production/DSMapBook/Visual_Basic/DSMapBookExt.cls.htm