Gets the Layers coordinate system.

Namespace:  ESRI.ArcGISExplorer.Mapping

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

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

Field Value

A CoordinateSystem object representing the coordinate system defined for the Layers underlying data.

Remarks

The coordinate system is used as a basis for determining geographical location for a layers underlying data. Coordinate systems are defined at the data level, therefore the Layer must be connected before this property can be utilized. If the Layer is not connected, this property will return nullNothingnullptra null reference (Nothing in Visual Basic).

Examples

The code below shows how to open a FeatureLayer that references data in a file geodatabase, prints out the extent and coordinate system for the Layer, and disconnects the Layer from the underlying data.
CopyC#
//The static Open methods will return an instance of a concrete layer type.

//If the connection information specified is incorrect, an exception will be thrown, therefore
//use a try... catch block to handle the exception.
try
{
  //Open a FeatureLayer based on a File Geodatabase feature class
  FeatureLayer featureLayer = FeatureLayer.OpenFileGeodatabaseTable(@"C:\Data\Forestry.gdb", "road_hazards");

  //Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is
  //connected to its underlying data source
  System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString());
  System.Diagnostics.Debug.Print(featureLayer.Extent.ToString());

  //Finished accessing the data, so Disconnect the layer from its data source
  featureLayer.Disconnect();
}
catch (ESRI.ArcGISExplorer.ConnectionException ex)
{
  System.Diagnostics.Debug.Print(ex.Message);
}
CopyVB.NET
'The static Open methods will return an instance of a concrete layer type.


'If the connection information specified is incorrect, an exception will be thrown, therefore
'use a try... catch block to handle the exception.
Try
  'Open a FeatureLayer based on a File Geodatabase feature class
  Dim featureLayer As FeatureLayer = featureLayer.OpenFileGeodatabaseTable("C:\Data\Forestry.gdb", "road_hazards")

  'Print out coordinate system and extent of the layer- these properties can only be accessed when the layer is
  'connected to its underlying data source
  System.Diagnostics.Debug.Print(featureLayer.CoordinateSystem.ToString())
  System.Diagnostics.Debug.Print(featureLayer.Extent.ToString())

  'Finished accessing the data, so Disconnect the layer from its data source
  featureLayer.Disconnect()
Catch ex As ESRI.ArcGISExplorer.ConnectionException
  System.Diagnostics.Debug.Print(ex.Message)
End Try

See Also