Map Class
Members  Example  See Also  Send Feedback
ESRI.ArcGIS.Mobile Namespace : Map Class

Represents a collection of geographic, annotation, and graphic layers drawn using a map transformation.

Object Model


Visual Basic (Declaration) 
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="ESRI.ArcGIS.Mobile.Designer.MapDesigner, ESRI.ArcGIS.Mobile.Designer, Culture=neutral")>
Public Class Map 
   Inherits Control
   Implements IIMap, IMapIMapEventsIMapWinFormsEvents 
[DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="ESRI.ArcGIS.Mobile.Designer.MapDesigner, ESRI.ArcGIS.Mobile.Designer, Culture=neutral")]
public class Map : Control, IIMap, IMapIMapEventsIMapWinFormsEvents  


The following example shows how to create and use the map control with a MobileServiceConnection.

Visual BasicCopy Code
MobileServiceConnection1.Url = "http://YOURSERVER/arcgis/services/YOURSERVICE/MapServer/MobileServer"
    MobileCache1.StoragePath = "C:\Temp\MapCache"
    Dim mobileSync As New MobileCacheSyncAgent(MobileCache1, MobileServiceConnection1)
    Dim mobileResults As New MobileCacheSyncResults()


C#Copy Code
MobileServiceConnection mobileServiceConnection1 = new MobileServiceConnection(); 
//link the mobile classes to put the data into the display 
mobileServiceConnection1.Url = @"http://YOURSERVER/arcgis/services/YOURSERVICE/MapServer/MobileServer"; 
mobileCache1.StoragePath = @"C:\Temp\MapCache"; 
MobileCacheSyncAgent mobileSync = new MobileCacheSyncAgent(mobileCache1, mobileServiceConnection1); 
MobileCacheSyncResults mobileResults = new MobileCacheSyncResults(); 


A map is a container for all of the spatial information that you display, query and edit on your mobile device. The way that you display maps in your mobile application is to use the map control. Spatial data drawn in map component can come from various data sources. It can come from a mobile service that you published in an ArcGIS Server, or from tile service from ArcGIS Online, or from local tile cache, and so on. For mobile service, the schema and map data will be stored in the MobileCache, and displayed in Map control by setting the MobileCache as one of the DataSources associated with the Map component.

For data collection and feature inspection, data has to be stored in local cache before it can be consumed by a map component. You can either pre-extract cache from ArcGIS server using a Geoprocessing tool available in ArcGIS desktop and store the data on your mobile device, or you can ask SyncAgent to get data from ArcGIS Server when it's needed, or a mixture of these two approaches. It's recommended that you use the GP tool to extract all layers from ArcGIS Server before your carry your mobile device out for field work, and synchronize your local data with ArcGIS Server when needed. For example, to push updated data back to server from your field device, or to get updated data from server to refresh your local cache data.

If you don't have data pre-cached on your client device and would like to automatically retrieve data from server and render it on the map component when the map extent changes, use a MobileCacheSyncAgent or other equivalent synchronization agents on map's ExtentChanged event.

Map layers are accessible by MapLayers property from which you can manipulate each layer's look-and-feel, including scale, extent, visibility, transparency, label, etc. Keep in mind that map layers stored in the MapLayerCollection and rendered in the Map component only serve the purpose of rendering the map to end-users, which implies that operations such as add/remove map layers from the MapLayerCollection doesn't impact the underlying layers stored in MobileCache.

The CurrentMapAction property allows you to assign a MapAction to the map, such as PanMapAction, ZoomInMapAction, ZoomOutMapAction, AddVertexSketchTool, DeleteVertexSketchTool, SelectionMapAction, etc. To detach MapAction from the map, set the CurrentMapAction property to null (in C#) or Nothing (in VB.Net).

There are a couple important concepts related to map extent, including Extent, Full Extent, Rotated Extent, and View Extent. These properties are accessible through GetExtent, GetFullExtent, GetRotatedExtent, GetViewExtent. The RotationAngel property gets/sets the rotation angel of the map, and the Scale property gets/sets map scale. For more information, see GetViewExtent.

If there is a need to convert coordinates between map units and client units, use ToMap and ToClient methods.

As a way to provide feedback to end user, the FlashGeometry method enables you to flash specified features (passed-in as parameters) a certain times using customized Pen and Brush.

To get a snapshot of current map, use GetMapImage method, e.g., to display the map image in a picture box or save it as an image file in local disk.

Use Refresh and Invalidate to refresh the display appropriately on map control. Refresh will redraw the whole client area while Invalidate will only redraw the client area where a change has occurred. Make sure you use Refresh method only when necessary because it will degrade drawing performance if it's called too frequently. If you only have a small area on your map that needs to redraw, use Invalidate() method with a envelope indicating the area that needs to be redrawn. For more information, see Refresh.

Inheritance Hierarchy



Namespace: ESRI.ArcGIS.Mobile

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

Assembly: ESRI.ArcGIS.Mobile (in ESRI.ArcGIS.Mobile.dll)

See Also