ArcGIS Runtime SDK for WPF - Library Reference
Map Class
Members  See Also 
ESRI.ArcGIS.Client Namespace : Map Class

Represents a Map control with a set of service layers that can be navigated using mouse and keyboard controls.

Object Model

Map ClassEnvelope ClassLayerCollection ClassLayer ClassMapGrid ClassSpatialReference ClassTimeExtent Class

Syntax

Visual Basic (Declaration) 
Public NotInheritable Class Map 
   Inherits System.Windows.Controls.Control
C# 
public sealed class Map : System.Windows.Controls.Control 

Remarks

The Map allows the user to zoom and pan around one or more map service layers placed on top of each other.

Navigation: The map has the following default navigation options:

User Action Description
Left Mouse Button Drag Pans the map.
Left Mouse Double-click Zooms the map in the amount specified in ZoomFactor around the map cursor.
Left Mouse Double-click + Shift Key Zooms the map out the amount specified in ZoomFactor around the map cursor.
Left Mouse Wheel Zooms the map in or out the amount specified in ZoomFactor around the map cursor.
Left mouse + Shift Key + Drag Drags a zoom box and zooms to the box.
Left Mouse + Shift Key + Ctrl Key + Drag Drags a zoom box and zooms out around the box.
Up Arrow Key Pans the map up.
Down Arrow Key Pans the map down.
Left Arrow Key Pans the map to the left.
Right Arrow Key Pans the map to the right.
+ Key Zooms in the amount specified in ZoomFactor around the map center.
- Key Zooms out the amount specified in ZoomFactor around the map center.
Pan/Drag Gesture
Pan/Drag Gesture
Pans in the direction the finger is moved.
Pinch Gesture
Pinch Gesture
Zooms in.
Stretch Gesture
Stretch Gesture
Zooms out.
Double-tap Gesture
Double-tap Gesture
Zooms in one zoom factor. The zoom factor is defined by the ZoomFactor property.
Flick Gesture
Flick Gesture
Pans in the direction of the flick and slowly comes to a stop.

If the map contains any tiled layers, the map will by default only allow you to zoom out and in to the range of the tiled cache resolution. However this value can be overridden explicitly by setting the MinimumResolution and MaximumResolution properties on the map. These values can also be used to limit how far the user can zoom in or out. If no tiled layers are present, these values defaults to System.Double.Epsilon and System.Double.MaxValue.

Layers: The control supports a set of base layer types that are supported for display within a map. These are:

Command Description
TiledMapServiceLayer Abstract layer type. Displays cached images arranged as a set of image tiles. See ArcGISTiledMapServiceLayer
DynamicLayer Abstract layer type. Displays non-cached images generated generated based on an image size and map extent. See ArcGISDynamicMapServiceLayer, ArcGISImageServiceLayer
GraphicsLayer Displays Graphics rendered on the client using a custom symbology and allows for user interaction (click, select, mouse over etc). Also see FeatureLayer
ElementLayer Allows the user to place any System.Windows.UIElement relative to a point or scaled to an extent on the map.

Spatial Reference: The Map's spatial reference is determined by the first layer in the map that has this property set. However, it can be overridden by explicitly setting the Extent property with an envelope that has a SpatialReference defined. This has to be done before any layers will be initialized by the map. Once the spatial reference of a map has been set and the layers has loaded, the spatial reference can no longer be changed. If you need to change spatial reference on the fly, you can instead create a new map instance, move the layers to this map, and replace the previous map instance. Also note that tiled layers does not support reprojection, and will not be displayed if the Map's SpatialReference does not match the spatial reference of the tiled layer.

Map Scale and Resolution: The map is scale agnostic, meaning that it doesn't deal with the scale of the map at any given point. Instead it exposes a resolution value that tells you how many map units one pixel represents. This has the benefit of being agnostic to the DPI (dots per inches) settings of your screen - something that a scale value is not. A large screen has a different scale than a smaller screen with the same amount of pixels across, and therefore the scale can be misleading when viewing the same map on two different screen, like for instance on a projector screen and a laptop.

If you were to assume a DPI setting on your screen (96dpi is a common used value) and you know the units used in your map's SpatialReference, you can calculate the scale of your map.

             Map scale = 1 : (ScreenRes pixels/inch * 39.37 inches/meter * (Map.Resolution * conversionFactorToMeters))
             
So if your map units are in meters and you have a screen resolution of 96dpi the current map scale is:
             Map scale = 1 : (96dpi * 39.37 inches/meter * (Map.Resolution * 1))
             

Creating a map instance with two layers and a startup extent:

             <esri:Map x:Name="MyMap" Extent="-120,20,-90,60">
               <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer" 
                    Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_ShadedRelief_World_2D/MapServer"/>
               <esri:ArcGISDynamicMapServiceLayer ID="DynamicLayer" Opacity="0.6" 
                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer"/>
             </esri:Map
             

Creating a map instance with a pre-defined spatial reference:

             <esri:Map x:Name="MyMap">
               <esri:Map.Extent>
                 <esri:Envelope XMin="661140" YMin="-1420246" XMax="3015668" YMax="1594451" >
                   <esri:Envelope.SpatialReference>
                     <esri:SpatialReference WKID="26777"/>
                   </esri:Envelope.SpatialReference>
                 </esri:Envelope>
               </esri:Map.Extent>
            
               <esri:ArcGISDynamicMapServiceLayer ID="DynamicLayer1"
                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
               <esri:ArcGISDynamicMapServiceLayer ID="DynamicLayer2"
                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Petroleum/KGS_OilGasFields_Kansas/MapServer"/>
             </esri:Map>
             

Inheritance Hierarchy

System.Object
   System.Windows.Threading.DispatcherObject
      System.Windows.DependencyObject
         System.Windows.Media.Visual
            System.Windows.UIElement
               System.Windows.FrameworkElement
                  System.Windows.Controls.Control
                     ESRI.ArcGIS.Client.Map

Requirements

Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.