ESRI.ArcGIS.ADF.IMS
SpatialReference Property
See Also  Example
ESRI.ArcGIS.ADF.IMS.Geometry Namespace > Geometry Class : SpatialReference Property




Gets or sets the SpatialReference of the Geometry.

Syntax

Visual Basic (Declaration) 
Public Property SpatialReference As SpatialReference
Visual Basic (Usage)Copy Code
Dim instance As Geometry
Dim value As SpatialReference
 
instance.SpatialReference = value
 
value = instance.SpatialReference
C# 
public SpatialReference SpatialReference {get; set;}

Example

The following example adds a point to the map in an acetate layer, using a different coordinate system for the point than for the map as a whole. After setting the coordinate system for the map (to Robinson), we create the point and set its coordinate system (to WGS84 geographic). Then we add the point to an acetate geometry element and the element to an acetate layer, and add the acetate layer to the map.
C#Copy Code
// Set the map to a new projection (Robinson) 

mapView.SpatialReference = 

    new ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference(54030); 

  

// Create a point and set its projection (WGS84) 

ESRI.ArcGIS.ADF.IMS.Geometry.Point pt = new ESRI.ArcGIS.ADF.IMS.Geometry.Point(75.0, 45.0); 

pt.SpatialReference = new ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference(4326); 

  

// Set up an acetate element and layer for the point 

ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleMarkerSymbol symbol =  

    new ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleMarkerSymbol( 

    System.Drawing.Color.Blue, 15,  

    ESRI.ArcGIS.ADF.IMS.Display.Symbol.MarkerSymbolType.Circle); 

ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement acetatePt =  

    new ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement( 

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.AcetateUnits.Database, pt, symbol); 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer acetateLayer =  

    new ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer("mapGraphics"); 

  

// Add the acetate layer to the map 

acetateLayer.AcetateElements.Add(acetatePt); 

mapView.Layers.Add(acetateLayer); 

    
Visual BasicCopy Code
' Set the map to a new projection (Robinson)

mapView.SpatialReference =

    New ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference(54030)



' Create a point and set its projection (WGS84)

Dim pt As New ESRI.ArcGIS.ADF.IMS.Geometry.Point(75.0, 45.0)

pt.SpatialReference = _

    New ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference(4326)



' Set up an acetate element and layer for the point

Dim symbol As New _

    ESRI.ArcGIS.ADF.IMS.Display.Symbol.SimpleMarkerSymbol( _

    System.Drawing.Color.Blue, 15,

    ESRI.ArcGIS.ADF.IMS.Display.Symbol.MarkerSymbolType.Circle)

Dim acetatePt As New _

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.GeometryElement(

    ESRI.ArcGIS.ADF.IMS.Display.AcetateElement.AcetateUnits.Database, pt, symbol)

Dim acetateLayer As New ESRI.ArcGIS.ADF.IMS.Carto.Layer.AcetateLayer("mapGraphics")



' Add the acetate layer to the map

acetateLayer.AcetateElements.Add(acetatePt)

mapView.Layers.Add(acetateLayer)

Remarks

The SpatialReference property may be used to specify the coordinate system or datum transformation of geometry. This is relevant in these situations:

  • For a GeometryElement in an acetate layer. This is required if the geometry is in a different coordinate system than the MapView.SpatialReference.
  • For an Envelope when used to specify the MapView.Extent. This enables specifying the map extent in one coordinate system, while the map itself is using a different coordinate system.
  • For a geometry object when used in a Filter. This is required when selecting features and the selection geometry is in a different coordinate system than the layer's coordinate system.

See Also

© 2010 All Rights Reserved.