This document is archived and information here might be outdated.  Recommended version.


IMap Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Carto)  

IMap Interface

Provides access to members that control the map.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use the IMap interface to display data from various data sources.

The IMap interface is a starting point for many of the tasks one does with a Map. For example, use IMap to add, delete, and access map layers containing data from various sources including feature layers and graphics layers; associate map surround objects (legends, scale bars, etc) with the Map; access the various properties of a Map including the area of interest, the current map units, and the spatial reference; select features and access the Map's current selection.

Members

Description
Read/write property ActiveGraphicsLayer The active graphics layer. If no graphic layers exist a basic memory graphics layer will be created.
Method AddLayer Adds a layer to the map.
Method AddLayers Adds multiple layers to the map, arranging them nicely if specified.
Method AddMapSurround Adds a map surround to the map.
Read/write property AnnotationEngine The annotation (label) engine the map will use.
Write-only property AreaOfInterest Area of interest for the map.
Read-only property Barriers The list of barriers and their weight for labeling.
Read-only property BasicGraphicsLayer The basic graphics layer.
Method ClearLayers Removes all layers from the map.
Method ClearMapSurrounds Removes all map surrounds from the map.
Method ClearSelection Clears the map selection.
Read/write property ClipBorder An optional border drawn around ClipGeometry.
Read/write property ClipGeometry A shape that layers in the map are clipped to.
Method ComputeDistance Computes the distance between two points on the map and returns the result.
Method CreateMapSurround Create and initialize a map surround. An optional style from the style gallery may be specified.
Method DelayDrawing Suspends drawing.
Method DelayEvents Used to batch operations together to minimize notifications.
Method DeleteLayer Deletes a layer from the map.
Method DeleteMapSurround Deletes a map surround from the map.
Read/write property Description Description of the map.
Read/write property DistanceUnits The distance units for the map.
Read/write property Expanded Indicates if the Map is expanded.
Read/write property FeatureSelection The feature selection for the map.
Method GetPageSize Gets the page size for the map.
Read/write property IsFramed Indicates if map is drawn in a frame rather than on the whole window.
Read-only property Layer The layer at the given index.
Read-only property LayerCount Number of layers in the map.
Read-only property Layers The layers in the map of the type specified in the uid. If recursive is true it will return layers in group layers.
Read/write property MapScale The scale of the map as a representative fraction.
Read-only property MapSurround The map surround at the given index.
Read-only property MapSurroundCount Number of map surrounds associated with the map.
Read/write property MapUnits The units for the map.
Method MoveLayer Moves a layer to another position.
Read/write property Name Name of the map.
Method RecalcFullExtent Forces the full extent to be recalculated.
Read/write property ReferenceScale The reference scale of the map as a representative fraction.
Method SelectByShape Selects features in the map given a shape and a selection environment (optional).
Method SelectFeature Selects a feature.
Read-only property SelectionCount Number of selected features.
Method SetPageSize Sets the page size for the map (optional).
Read/write property SpatialReference The spatial reference of the map.
Read/write property SpatialReferenceLocked Indicates whether the spatial reference is prevented from being changed.
Read/write property UseSymbolLevels Indicates if the Map draws using symbol levels.

CoClasses that implement IMap

CoClasses and Classes Description
Globe (esriGlobeCore) A container for the display and manipulation of data in the Globe.
Map A container for the display and manipulation of map data.
Scene (esri3DAnalyst) A container for the display and manipulation of data.

Remarks

The IMap interface is a starting point for many of the tasks one does with a map. For example, you can use IMap to add, delete, and access map layers containing data from various sources, including feature layers and graphics layers; associate map surround objects (legends, scale bars, and so on) with the map; access the various properties of a map, including the area of interest, the current map units, and the spatial reference; select features and access the Map object�s current selection.

Every map document contains at least one Map object. Only one Map can have focus at a time, and this Map is called the focus map. IMxDocument provides access to all of the Map objects loaded in the document; IMxDocument::FocusMap returns a reference (IMap) to the Map currently with focus, and IMxDocument::Maps returns a reference (IMaps) to the entire collection of Map objects. A map document can contain any number of Map objects �the focus map always represents the data view.

The Map object, manages a collection of Layer objects. Each layer has a spatial reference. A spatial reference defines a resolution (1/precision) and a coordinate system. The map coordinate system is automatically set to the coordinate system of the first layer loaded in the map and the resolution (1/precision) is calculated based on the union of all the layers extents.

See Also

IMxDocument.FocusMap Property | IMxDocument.Maps Property | IMaps Interface

.NET Snippets

Get GeoFeatureLayer from Layer Index Number | Get All Features from Point Search in GeoFeatureLayer | Add Graphic to Map | Get MxApplication from ArcMap | Add GeoDataset Raster To Map | Get Index Number from Layer Name | Set Data Source | Do Identify | TimeControl Playback | Toggle to Dynamic Display | Add Scale Bar | Get First Feature from Point Search in GeoFeatureLayer | Add North Arrow | Change Map Spatial Reference | Get BasicMap from Map | Add Layer File to ActiveView | Add Legend | Create Graphic Buffers around Selected Features | Get Map from ArcMap | Add Event Wiring for All IActiveViewEvents | Loop Through Layers of Specific UID | Get FeatureLayer from Layer Index Number | Add Hyperlink | Zoom to Layer by Index Number | Toggle Visibility Of Composite Layer | Add Tracking Layer To Map

.NET Samples

Convert part to feature command (Code Files: ConvertPart) | Custom map navigation commands (Code Files: Pan ZoomIn ZoomOut) | Dynamic logo (Code Files: DynamicLogo) | Editing using a custom form (Code Files: EditorForm) | Displaying a TOCControl context menu (Code Files: TOCContextMenuForm) | Make a custom time slider (Code Files: CustomTimeSliderButton) | Custom map selection commands (Code Files: SelectFeatures) | Utility wizard for basic schematic datasets configuration (Code Files: GenerateSchematicTemplate) | Selection restriction evaluator (Code Files: SelectionRestrictionEvaluator) | Custom UI elements using add-ins (Code Files: AddGraphicsTool) | Implementing a schematic digitizing tool (Code Files: DigitTool) | Synchronized MapControl and PageLayoutControl application (Code Files: ControlsSynchronizer frmMain Maps OpenNewMapDocument) | Implementing an XML builder external component (Code Files: XMLDocImpl) | Applying a time offset to a time-aware feature layer (Code Files: TimeOffsetButton) | Dynamic cache layer manager controller (Code Files: CacheManagerDlg) | Layer filtering TOC view (Code Files: TOCLayerFilter) | Change layer rendering using the SymbologyControl (Code Files: LayerRendering) | Graphics layers ToolControl (Code Files: GraphicsLayersListCtrl NewGraphicsLayerCmd) | Set the time extents for a layer then render the layer (Code Files: SetTimeExtentsButton) | Simple dynamic display application (Code Files: CreateNewDocument) | Committing ink sketches using the controls ink commands (Code Files: InkSketchCommit) | Move a graphic along a path in ArcMap (Code Files: cmdMoveGraphicAlongPath) | Copy the PageLayoutControl focus map and overwrite the MapControl map (Code Files: CopyFocusMap) | Buffer snap agent (Code Files: BufferSnap) | Subset network evaluators (Code Files: AutoUpdateNetworkElementArrayParametersCommand SubsetHelperUI) | Implementing a property page for an ArcGIS Engine application (Code Files: CreateNewDocument) | Multivariate renderer (Code Files: MultivariateRendPropPage PropPageForm) | Create a custom tool (Code Files: DrawGraphicLine) | Save a layer file in a MapControl application (Code Files: CreateNewDocument) | Custom selection extension (Code Files: SelectionExtension ZoomToLayerMultiItem) | Create a custom selection extension by extending ArcObjects (Code Files: SelectionExtension ZoomToLayerMultiItem) | Schematic diagram auto refresh (Code Files: FormAutorefresh) | Schematics Engine application (Code Files: CreateNewDocument MainForm) | Temporal statistics (Code Files: CreateNewDocument)

.NET Related Topics

Add-in coding patterns | Adjusting feature locations with spatial adjustment | CatalogUI | Converting labels to geodatabase annotation for a single layer | Converting labels to geodatabase annotation for an entire map | Converting labels to map annotation for a single layer | Create a custom tool | Creating and working with basemap layers | GeoData services | How to access maps and layers via the MapDocument | How to access maps and layers via the MxDocument | How to add a layer to a map from a layer file | How to add different types of layers to a map | How to create a mosaic layer | How to create a raster catalog layer | How to create a raster layer | How to create an edit session | How to create AOIs and bookmarks | How to create map grids | How to use symbol level drawing | How to wire custom events using IActiveViewEvents | LocationUI | Managing application state | Map services | Maplex | Performing basic map functions | Performing map selection | Persisting cache information for use in dynamic display | Programming with server objects | Releasing COM references | Using ArcObjects as tool input | Using the TOCControl | Working with map elements | Working with map surrounds | Working with PageLayout elements