ArcGIS Runtime SDK for WPF - Library Reference
SpatialReference Property
See Also  Example
ESRI.ArcGIS.Client Namespace > Map Class : SpatialReference Property

Gets the spatial reference of the Map Class. Note: this Property is ReadOnly.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property SpatialReference As SpatialReference
C# 
public SpatialReference SpatialReference {get;}

Remarks

The spatial reference is a combination of an ellipsoid, datum, and a coordinate system used to display geographic data of the three dimensional Earth on a two dimensional surface (such as a piece of paper of computer monitor). A good article for describing how a spatial reference works can be found here.

The SpatialReference is determined by the first layer in the Map that has this property set. When more than one layer is added to a Map, all subsequent layers (if they support re-projection on-the-fly from ArcGIS Server) are re-projected to the same SpatialReference as the first layer so that the spatial data overlays properly. The following diagram shows for each layer type whether its SpatialReference can be re-projected or not:

SpatialReference projection status for various layer types.

The SpatialReference of the Map can be overridden (meaning that you can set the Map.SpatialReference) by explicitly setting the Map.Extent Property with an Envelope that has an Envelope.SpatialReference defined. Initializing a Map’s SpatialReference via the Map.Extent Property has to be done before any layers will be added to the Map. Once the SpatialReference of a Map has been set and the layers have been loaded, the SpatialReference can no longer be changed. If you need to change SpatialReference on the fly, you can instead create a new Map instance, move the layers to this Map, and replace the previous Map instance.

Tiled map services (specifically: ArcGISTiledMapServiceLayer and Client.Toolkit.DataSources.OpenStreetMapLayer) do not support on-the-fly re-projection, and will not be displayed if the Map.SpatialReference does not match the tiled map service SpatialReference. Since tiled map services are typically the first layer in a Map to serve as a base layer for other layers to draw on top of, the tiled map service layer often becomes the default SpatialReference for the Map.

If a layer is added to the Map and that layer’s SpatialReference does not match the Map.SpatialReference and it is not possible for that layer to be re-projected on the fly, then that layer will not display in the Map.

A listing of the well-known SpatialReference WKID Integer and WKT String values are available for Projected Coordinate Systems and Geographic Coordinate Systems.

Performance Tip: By default, the Map Control will not render until all layers have been initialized. This process ensures that the Map will start up at the full Extent of all layers and use the preferred SpatialReference discovered at runtime. However, if you have many layers in your Map or if one layer takes a while to initialize, users may have wait a significant amount of time to see the first Map. To improve startup time of the Map Control define the initial Map.Extent including its SpatialReference. Then the Map will not need to discover this information at runtime and as a result individual layers will start loading as soon as they initialize.

The following screen shot shows three different Map Controls that have the same layers added to each Map but have dramatically different drawing results because of having different Map.SpatialReference values set. Each Map has its Extent set to approximately to the same geographic area of coverage given the different SpatialReference’s of the layers. The layers being added to each Map Control, in drawing order, are:

  1. ArcGISTiledMapServiceLayer with a SpatialReference WKID = 4326
  2. ArcGISDynamicMapServiceLayer with a SpatialReference WKID = 4269
  3. ArcGISDynamicMapServiceLayer with a SpatialReference WKID = 102113

Map1 displays all three layers without any problem. The ArcGISTiledMapServiceLayer (1) automatically sets the default Map.SpatialReference (WKID = 4326) value and the other layers (2 and 3) have their SpatialReference re-projected on-the-fly by ArcGIS Server.

Map2 only displays layers 2 and 3 (the ArcGISDynamicMapServiceLayer’s) because the Map.SpatialReference (WKID = 4269) has been set manually to something that is different than what the ArcGISTiledMapServiceLayer.SpatialReference is.

Similarly, Map3 only displays layers 2 and 3 (the ArcGISDynamicMapServiceLayer’s) because the Map.SpatialReference (WKID = 102113) has been set manually to something that is different than what the ArcGISTiledMapServiceLayer.SpatialReference is.

The screen shot matches the code examples provided in this document.

Example of three different Map.SpatialReference for the same layers.

Example

XAMLCopy Code
<Grid x:Name="LayoutRoot" Background="White">
	       
  <!--
  Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  Layers Collection is on the bottom and the other Layers are added on the top. 
  The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
	  
  IMPORTANT:
  No SpatialReference will be explicitly set via code-behind. The SpatialReference of the Map will automatically
  default to the ArcGISTiledMapServiceLayer.
	  
  Zoom to a specific extent
	  
  Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
	  
  Add a second ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  -->
  <esri:Map Background="White" Margin="12,238,538,12" Name="map1" Height="250" Width="250">
    <esri:Map.Extent >
      <esri:Envelope XMin="-96.96" YMin="40.53" XMax="-96.38" YMax="41.11"/>
    </esri:Map.Extent>
    <esri:LayerCollection>
      <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"/>
    </esri:LayerCollection>
  </esri:Map>
	  
  <!--
  Manually change the Map.SpatialReference to WKID = 4269 by setting an initial Map.Extent where
  the Envelope has a defined SpatialReference.
	  
  Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  Layers Collection is on the bottom and the other Layers are added on the top.
  The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
	  
  IMPORTANT:
  Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means that even
  though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	  
  Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
	  
  Add a second ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
  -->
  <esri:Map Background="White" Margin="276,238,274,12" Name="map2" Height="250" Width="250">
    <esri:Map.Extent >
      <esri:Envelope XMin="-96.96" YMin="40.53" XMax="-96.38" YMax="41.11">
        <esri:Envelope.SpatialReference>
          <esri:SpatialReference WKID="4269"/>
        </esri:Envelope.SpatialReference>
      </esri:Envelope>
    </esri:Map.Extent>
    <esri:LayerCollection>
      <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"/>
    </esri:LayerCollection>
  </esri:Map>
	          
  <!--
  Manually change the Map.SpatialReference to WKID = 102113 by setting an intial Map.Extent where
  the Envelope has a defined SpatialReference.
	          
  Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  Layers Collection is on the bottom and the other Layers are added on the top.
  The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
	  
  IMPORTANT:
  Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means tha even
  though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	          
  Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
	  
  Add a second ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  -->
  <esri:Map Background="White" Height="250" Margin="540,238,10,12" Name="map3" Width="250">
    <esri:Map.Extent >
      <esri:Envelope XMin="-10797321" YMin="4950149" XMax="-10734765" YMax="5012706">
        <esri:Envelope.SpatialReference>
          <esri:SpatialReference WKID="102113"/>
        </esri:Envelope.SpatialReference>
      </esri:Envelope>
    </esri:Map.Extent>
    <esri:LayerCollection>
      <esri:ArcGISTiledMapServiceLayer Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"/>
      <esri:ArcGISDynamicMapServiceLayer Url="http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"/>
    </esri:LayerCollection>
  </esri:Map>
	  
</Grid>
C#Copy Code
public void DrawWKID4326(ESRI.ArcGIS.Client.Map myMap)
{
	  
  // Clear out any existing layers
  myMap.Layers.Clear();
	  
  // Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  // Layers Collection is on the bottom and the other Layers are added on the top. 
  // The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer();
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1);
	  
  // IMPORTANT:
  // No SpatialReference will be explicitly set via code-behind. The SpatialReference of the Map will automatically
  // default to the ArcGISTiledMapServiceLayer.
	  
  // Zoom to a specific extent
  ESRI.ArcGIS.Client.Geometry.Envelope forcedEnvelope = new ESRI.ArcGIS.Client.Geometry.Envelope(-96.96, 40.53, -96.38, 41.11);
  myMap.Extent = forcedEnvelope;
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1);
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2);
	  
}
	  
public void DrawWKID4269(ESRI.ArcGIS.Client.Map myMap)
{
	  
  // Clear out any existing layers
  myMap.Layers.Clear();
	  
  // Manually change the Map.SpatialReference to WKID = 4269 by setting an initial Map.Extent where
  // the Envelope has a defined SpatialReference.
  ESRI.ArcGIS.Client.Geometry.SpatialReference forcedSpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4269);
  ESRI.ArcGIS.Client.Geometry.Envelope forcedEnvelope = new ESRI.ArcGIS.Client.Geometry.Envelope(-96.96, 40.53, -96.38, 41.11);
  forcedEnvelope.SpatialReference = forcedSpatialReference;
  myMap.Extent = forcedEnvelope;
	  
  // Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  // Layers Collection is on the bottom and the other Layers are added on the top.
  // The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer();
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1);
	  
  // IMPORTANT:
  // Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means that even
  // though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1);
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2);
	  
}
	  
public void DrawWKID102113(ESRI.ArcGIS.Client.Map myMap)
{
	  
  // Clear out any existing layers
  myMap.Layers.Clear();
	  
  // Manually change the Map.SpatialReference to WKID = 102113 by setting an initial Map.Extent where
  // the Envelope has a defined SpatialReference.
  ESRI.ArcGIS.Client.Geometry.SpatialReference forcedSpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102113);
  ESRI.ArcGIS.Client.Geometry.Envelope forcedEnvelope = new ESRI.ArcGIS.Client.Geometry.Envelope(-10797321, 4950149, -10734765, 5012706);
  forcedEnvelope.SpatialReference = forcedSpatialReference;
  myMap.Extent = forcedEnvelope;
	  
  // Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  // Layers Collection is on the bottom and the other Layers are added on the top.
  // The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer myArcGISTiledMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer();
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1);
	  
  // IMPORTANT:
  // Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means that even
  // though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 102113
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer1 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1);
	  
  // Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  // Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 102113
  ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer2 = new ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer();
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer";
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2);
	  
}
VB.NETCopy Code
Public Sub DrawWKID4326(ByVal myMap As ESRI.ArcGIS.Client.Map)
	  
  ' Clear out any existing layers
  myMap.Layers.Clear()
	  
  ' Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  ' Layers Collection is on the bottom and the other Layers are added on the top. 
  ' The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  Dim myArcGISTiledMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1)
	  
  ' IMPORTANT:
  ' No SpatialReference will be explicitly set via code-behind. The SpatialReference of the Map will automatically
  ' default to the ArcGISTiledMapServiceLayer.
	  
  ' Zoom to a specific extent
  Dim forcedEnvelope As New ESRI.ArcGIS.Client.Geometry.Envelope(-96.96, 40.53, -96.38, 41.11)
  myMap.Extent = forcedEnvelope
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  Dim myArcGISDynamicMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1)
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4326
  Dim myArcGISDynamicMapServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2)
	  
End Sub
	  
Public Sub DrawWKID4269(ByVal myMap As ESRI.ArcGIS.Client.Map)
	  
  ' Clear out any existing layers
  myMap.Layers.Clear()
	  
  ' Manually change the Map.SpatialReference to WKID = 4269 by setting an initial Map.Extent where
  ' the Envelope has a defined SpatialReference.
  Dim forcedSpatialReference As New ESRI.ArcGIS.Client.Geometry.SpatialReference(4269)
  Dim forcedEnvelope As New ESRI.ArcGIS.Client.Geometry.Envelope(-96.96, 40.53, -96.38, 41.11)
  forcedEnvelope.SpatialReference = forcedSpatialReference
  myMap.Extent = forcedEnvelope
	  
  ' Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  ' Layers Collection is on the bottom and the other Layers are added on the top.
  ' The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  Dim myArcGISTiledMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1)
	  
  ' IMPORTANT:
  ' Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means that even
  ' though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
  Dim myArcGISDynamicMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1)
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 4269
  Dim myArcGISDynamicMapServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2)
	  
End Sub
	  
Public Sub DrawWKID102113(ByVal myMap As ESRI.ArcGIS.Client.Map)
	  
  ' Clear out any existing layers
  myMap.Layers.Clear()
	  
  ' Manually change the Map.SpatialReference to WKID = 102113 by setting an intial Map.Extent where
  ' the Envelope has a defined SpatialReference.
  Dim forcedSpatialReference As New ESRI.ArcGIS.Client.Geometry.SpatialReference(102113)
  Dim forcedEnvelope As New ESRI.ArcGIS.Client.Geometry.Envelope(-10797321, 4950149, -10734765, 5012706)
  forcedEnvelope.SpatialReference = forcedSpatialReference
  myMap.Extent = forcedEnvelope
	  
  ' Add an ArcGISTiledMapsServiceLayer as a background to the map. Note: The first Layer added to the Map's
  ' Layers Collection is on the bottom and the other Layers are added on the top.
  ' The ArcGISTiledMapServiceLayer.SpatialReference.WKID = 4326.
  Dim myArcGISTiledMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISTiledMapServiceLayer
  myArcGISTiledMapServiceLayer1.Url = "http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"
  myMap.Layers.Add(myArcGISTiledMapServiceLayer1)
	  
  ' IMPORTANT:
  ' Because the myArcGISTiledMapServiceLayer is a tiled layer it cannot be re-projected. This means tha even
  ' though the myArcGISTiledMapServiceLayer is added as a layer to the map, it will not display.
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 4269.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 102113
  Dim myArcGISDynamicMapServiceLayer1 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer1.Url = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer1)
	  
  ' Add a ArcGISDynamicMapServiceLayer with an initial SpatialReference.WKID = 102113.
  ' Note: ArcGIS Server will automatically re-project the ArcGISDynamicMapServiceLayer.SpatialReference.WKID to 102113
  Dim myArcGISDynamicMapServiceLayer2 As New ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer
  myArcGISDynamicMapServiceLayer2.Url = "http://serverapps.esri.com/ArcGIS/rest/services/Crime2008/MapServer"
  myMap.Layers.Add(myArcGISDynamicMapServiceLayer2)
	  
End Sub

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.