Represents the coordinate system which is used by a Geometry, Layer, or Map as a basis for determining geographical location.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

C#
public sealed class CoordinateSystem : IXmlSerializable
Visual Basic (Declaration)
Public NotInheritable Class CoordinateSystem _
	Implements IXmlSerializable

Remarks

A coordinate system defines a framework for geographical data coordinates. It determines spatial units, and how a set of coordinates are positioned on the earths surface. See the Coordinate System Concepts topic for more information.

Each Layer in ArcGIS Explorer has a CoordinateSystem (for example, in order to add raster data to Explorer, it must indicate its coordinate system). Also, each Geometry created in ArcGIS Explorer has a CoordinateSystem which is used to display geometries which define the locations of Graphics or Notes. By default, new geometries have the WGS 1984 coordinate system; if the Geometry comes from a Table then it will have the same CoordinateSystem as the Table. Finally, the MapDisplay draws using a CoordinateSystem. The 3D DisplayMode always uses the WGS 1984 geographic coordinate system, and the 2D DisplayMode may be set to draw with any available coordinate system; the default in 2D is also WGS 1984.

If a geometry has a different coordinate system to the MapDisplay in which it is drawn, then it is automatically reprojected at draw time to display correctly in the MapDisplay. This automatic reprojection happens for Graphics and all types of MapItem - you do not need to add any code for these items to be projected correctly.

You can create a new CoordinateSystem object by using one of the following methods (example code showing these options is available with the member documentation):

  1. By browsing to the coordinate system using intellisense, using the nested type initializers for CoordinateSystem..::.GeographicCoordinateSystems and CoordinateSystem..::.ProjectedCoordinateSystems.
  2. By coordinate system identifier, using the CoordinateSystem(Int32) constructor.

    Note that coordinate system identifiers can occasionally change between releases; where codes have changed in this release this is noted in the applicable nested type initializer properties, but for full information see the Known Issues list.

  3. By referring to a .prj file which contains coordinate system information, using the CoordinateSystem(String) constructor.

The Type property indicates whether a CoordinateSystem object is geographic or projected, and the Unit property indicates the units of measurement used to define locations; for example, the WGS 1984 geographical coordinate system defines locations using degrees.

CoordinateSystems are serializable to XML via the CreateFromXmlString(String) and ToXmlString()()() methods. They can also be created or written out to the standard projection string format used in ESRI .prj files, using the ExportToPrjString()()() and ImportFromPrjString(String) methods.

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

Inheritance Hierarchy

System..::.Object

  ESRI.ArcGISExplorer.Geometry..::.CoordinateSystem

See Also