Converts an ArcGIS Explorer CoordinateSystem object to an ArcGIS Server SOAP SpatialReference object.

Namespace:  ESRI.ArcGISExplorer.Geometry

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

Syntax

C#
public static TSoap CoordinateSystemToSoap<TSoap>(
	CoordinateSystem coordinateSystem
)
Visual Basic (Declaration)
Public Shared Function CoordinateSystemToSoap(Of TSoap) ( _
	coordinateSystem As CoordinateSystem _
) As TSoap

Parameters

coordinateSystem
Type: ESRI.ArcGISExplorer.Geometry..::.CoordinateSystem

The ArcGIS Explorer CoordinateSystem to convert.

Type Parameters

TSoap
The SOAP SpatialReference subtype Type (ProjectedCoordinateSystem or GeographicCoordinateSystem).

Return Value

A SOAP SpatialReference object of type TSoap based on the properties of the coordinateSystem.

Remarks

Use this method to convert ArcGIS Explorer CoordinateSystem objects into corresponding SOAP objects. You must specify the SOAP SpatialReference type as the type parameter for this generic method by passing in the SOAP Type defined in your web service reference.

You must always specify the most-derived Type - for example specify a SOAP Type of ProjectedCoordinateSystem or GeographicCoordinateSystem and not SpatialReference.

Examples

The code below shows you how to convert ArcGIS Explorer CoordinateSystem to a SOAP SpatialReference by using the CoordinateSystemToSoap generic method. It demonstrates using the specific SOAP subtype. ArcGIS Explorer Types are fully-qualified to avoid confusion, with the exception of the SOAP types - you must ensure you have a using/Imports statement to your SOAP web reference namespace or fully-qualify the SOAP types in your own code.
CopyC#
// Remember you will need a using (Imports in Visual Basic) statement to the namespace of the SOAP definitions
// for your web references, e.g. the namespace containing the SpatialReference SOAP type.

// Create an ArcGIS Explorer CoordinateSystem.
ESRI.ArcGISExplorer.Geometry.CoordinateSystem xoCoordinateSystem = ESRI.ArcGISExplorer.Geometry.CoordinateSystem.ProjectedCoordinateSystems.Polar.NorthPoleStereographic;

SpatialReference soapSpatialReference = null;
// Convert to the correct specific SOAP SpatialReference subtype with CoordinateSystemToSoap<SOAP Type>.
if (xoCoordinateSystem.Type == CoordinateSystemType.Projected)
{
    ProjectedCoordinateSystem soapProj = SoapConverter.CoordinateSystemToSoap<ProjectedCoordinateSystem>(xoCoordinateSystem);
    soapSpatialReference = soapProj;
}
else
{
    GeographicCoordinateSystem soapGeo = SoapConverter.CoordinateSystemToSoap<GeographicCoordinateSystem>(xoCoordinateSystem);
    soapSpatialReference = soapGeo;
}
CopyVB.NET
' Remember you will need a using (Imports in Visual Basic) statement to the namespace of the SOAP definitions
' for your web references, e.g. the namespace containing the SpatialReference SOAP type.


' Create an ArcGIS Explorer CoordinateSystem.
Dim xoCoordinateSystem As ESRI.ArcGISExplorer.Geometry.CoordinateSystem = ESRI.ArcGISExplorer.Geometry.CoordinateSystem.ProjectedCoordinateSystems.Polar.NorthPoleStereographic
Dim soapSpatialReference As SpatialReference = Nothing
' Convert to the correct specific SOAP SpatialReference subtype with CoordinateSystemToSoap(Of SOAP Type).
If xoCoordinateSystem.Type = CoordinateSystemType.Projected Then
    Dim soapProj As ProjectedCoordinateSystem = SoapConverter.CoordinateSystemToSoap(Of ProjectedCoordinateSystem)(xoCoordinateSystem)
    soapSpatialReference = soapProj
Else
    Dim soapGeo As GeographicCoordinateSystem = SoapConverter.CoordinateSystemToSoap(Of GeographicCoordinateSystem)(xoCoordinateSystem)
    soapSpatialReference = soapGeo
End If

See Also