Returns a string indicating the name and identifier of this CoordinateSystem.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

C#
public override string ToString()
Visual Basic (Declaration)
Public Overrides Function ToString As String

Return Value

A string indicating the name and identifier of this CoordinateSystem.

Remarks

ToString will return the name and identifier of the CoordinateSystem, and is suitable for use in debugging to quickly check the type of coordinate system which is being represented. The Name and Id of the CoordinateSystem can also be returned separately by using the Name and Id properties.

The string returned by this method is different to the string returned by ExportToPrjString()()().

Examples

The code below shows how you can identify any layers in the current MapDisplay with a CoordinateSystem that is different to that of the MapDisplay. A list of all Layers is created, showing which use the same CoordinateSystem as the MapDisplay, and which use a different CoordinateSystem (and are therefore reprojected automatically when drawn), and creates a list of these layers. The code assumes you have imported the Geometry and Mapping namespaces.
CopyC#
// Identify the CoordinateSystem of the current DisplayMode using the shortcut property.
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
CoordinateSystem dispCS = disp.CurrentCoordinateSystem;

// Iterate all Layers in the Map.
StringBuilder sameCs = new StringBuilder(Environment.NewLine);
StringBuilder diffCs = new StringBuilder(Environment.NewLine);
System.Collections.ObjectModel.ReadOnlyCollection<Layer> layers = disp.Map.GetMapItems<Layer>();
foreach (Layer lyr in layers)
{
    // Show information about the CoordinateSystem using the overloaded ToString method.
    string info = lyr.Name + ": " + lyr.CoordinateSystem.ToString();
    // Compare the systems using the Id property.
    if (lyr.CoordinateSystem.Id == dispCS.Id)
        sameCs.AppendLine(info);
    else
        diffCs.AppendLine(info);
}

// Show the results.
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine +
    "Layers which do not require reprojecting: " + sameCs.ToString(), "Layer Coordinate Systems");
CopyVB.NET
' Identify the CoordinateSystem of the current DisplayMode using the shortcut property.
Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Dim dispCS As CoordinateSystem = disp.CurrentCoordinateSystem

' Iterate all Layers in the Map.
Dim sameCs As New StringBuilder(Environment.NewLine)
Dim diffCs As New StringBuilder(Environment.NewLine)
Dim layers As System.Collections.ObjectModel.ReadOnlyCollection(Of Layer) = disp.Map.GetMapItems(Of Layer)()
Dim lyr As Layer
For Each lyr In layers
    ' Show information about the CoordinateSystem using the overloaded ToString method.
    Dim info As String = lyr.Name & ": " & lyr.CoordinateSystem.ToString()
    ' Compare the systems using the Id property.
    If lyr.CoordinateSystem.Id = dispCS.Id Then
        sameCs.AppendLine(info)
    Else
        diffCs.AppendLine(info)
    End If
Next lyr

' Show the results.
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine + _
                                "Layers which do not require reprojecting: " + sameCs.ToString(), _
                                "Layer Coordinate Systems")

See Also