ArcMap: Working with multiple DataFrames

April 26, 2008

(From ESRI) The viewer window is a new window that was introduced at 9.2 to enable users to work with one data frame at multiplescales. In the 9.2 release if you opened a viewer window and then activated a different data frame in your map document, the viewer window was automatically closed. In Service Pack 2, ESRI has enhanced viewer windows so that you can use them to view inactive data frames. Now if you activate a different data frame while a viewer window is open, that viewer window remains on-screen, enabling you to work with multiple data frames side by side.

When you work with an inactive data frame in a viewer window, you can easily make the viewer show the same location that is currently displayed in the active data frame in the main ArcMap window. Similarly, you can update the location shown in the active data frame in the main ArcMap window to match the location shown in any of your viewer windows.

The ability to work with multiple data frames side-by-side in ArcMap can be useful for analysis, historical change assessment, data evaluation, and other applications where you want to be able to see different datasets for the same area side by side, as opposed to working with all the data in one data frame, or working with multiple map documents.

Pictures and more details demonstrating this can be found here

Add layer to Map with “autoArrange”

April 16, 2008

One of the very common operations programmers do in ArcObjects is adding a layer to the Map. To do this there are two ways, one using IMap.AddLayer or IMapLayers.AddLayer.

IMap.AddLayer adds the new layer on the top of all the layers in the map. This is not very useful as we normally want the point layers at the top followed by polyline followed by polygon layers. Adding polygon layers at the top would mask all other layers below.

IMapLayers.AddLayer is preferable because it has an option to autoArrange the newly added layer in the table of contents. If autoArrange is set to TRUE, the layer is added in the proper position as by its weight specified via ILayerPosition::LayerWeight. By default, this means that the layers are sorted by layer type – Annotation layers on top, followed by Point geometry layers, Polyline geometry layers, and at the bottom Polygon geometry layers.