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

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

Object Model








Syntax

Visual Basic (Declaration) 
Public Class Map 
   Inherits UserControl
   Implements IIMap, IMapIMapEvents 
C# 
public class Map : UserControl, IIMap, IMapIMapEvents  

Example

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()

MobileServiceConnection1.CreateCache(MobileCache1)
MobileCache1.Open()
mobileSync.Synchronize()
Map1.MapLayers.Add(MobileCache1)
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(); 
 
mobileServiceConnection1.CreateCache(mobileCache1); 
mobileCache1.Open(); 
mobileSync.Synchronize(); 
map1.MapLayers.Add(mobileCache1);

Remarks

Note for developers: Be sure to call Dispose() when finished using this class, otherwise you may encounter some issues.

A map is a container for all of the spatial information that you display, query and edit on your mobile application. 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 adding the MobileCache to the MapLayers.

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.

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

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
                     System.Windows.Controls.ContentControl
                        System.Windows.Controls.UserControl
                           ESRI.ArcGIS.Mobile.WPF.Map

Requirements

Target 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

See Also

© 2013 All Rights Reserved.