ESRI.ArcGIS.ADF.IMS
Compare(SpatialReference,SpatialReference) Method
See Also  Example
ESRI.ArcGIS.ADF.IMS.SpatialReference Namespace > SpatialReference Class > Compare Method : Compare(SpatialReference,SpatialReference) Method




aSpatialReferernce
otherSpatialReference
Compares two SpatialReferences for identical values for coordinate system and datum transformation.

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function Compare( _
   ByVal aSpatialReferernce As SpatialReference, _
   ByVal otherSpatialReference As SpatialReference _
) As Boolean
Visual Basic (Usage)Copy Code
Dim aSpatialReferernce As SpatialReference
Dim otherSpatialReference As SpatialReference
Dim value As Boolean
 
value = SpatialReference.Compare(aSpatialReferernce, otherSpatialReference)
C# 
public static bool Compare( 
   SpatialReference aSpatialReferernce,
   SpatialReference otherSpatialReference
)

Parameters

aSpatialReferernce
otherSpatialReference

Return Value

Boolean value that is true for equality, false for unequality.

Example

The following example tests whether a MapView and the MapService from which the MapView derives have the same SpatialReference. This would indicate whether the MapView's coordinate system or datum transformation values have been changed since being created from the MapService. The code assumes an existing MapView object.
C#Copy Code
bool areSameSpatialRef =  

    ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference.Compare( 

    mapView.SpatialReference, 

    mapView.MapService.ServiceSpatialReference); 

    
Visual BasicCopy Code
Dim areSameSpatialRef As Boolean =

    ESRI.ArcGIS.ADF.IMS.SpatialReference.SpatialReference.Compare(

    mapView.SpatialReference,

    mapView.MapService.ServiceSpatialReference);

Remarks

This method compares the ID values or definition strings for the CoordinateSystem and DatumTransformation of the current and input SpatialReferences. The method returns true if both CoordinateSystem and DatumTranformation values are the same. Each of the CoordinateSystem properties and DatumTransformation and properties must use the same SpatialReferenceInfo type (DefinitionSpatialReferenceInfo or IDSpatialReferenceInfo). The method does not convert between definition string and ID. For example, if one SpatialReference has a coordinate system based on the WGS84 ID of 4326, and the other uses the definition string for WGS84, this method will return false.

This method is a static (Shared) method, so that it is used without constructing an instance of SpatialReference.

See Also

© 2010 All Rights Reserved.