ISpatialReference2 Interface

Provides access to additional members that control a SpatialReference.

Description

Extends the ISpatialReference interface by adding functions to compare precision (resolution) of two spatial references, and round off coordinate data to the current resolution.

Members

Name Description
Read-only property Abbreviation The abbreviated name of this spatial reference component.
Read-only property Alias The alias of this spatial reference component.
Method ApplyPrecision Applies the measure and z value precisions.
Method ApplyXYPrecision Applies the XY precision.
Method Changed Notify this object that some of its parts have changed (parameter values, z unit, etc.).
Read-only property FactoryCode The factory code (WKID) of the spatial reference.
Method GetDomain The XY domain extent.
Method GetFalseOriginAndUnits Get the false origin and units.
Method GetMDomain The measure domain extent.
Method GetMFalseOriginAndUnits Get the measure false origin and units.
Method GetZDomain The Z domain extent.
Method GetZFalseOriginAndUnits Get the Z false origin and units.
Method HasMPrecision Returns true when m-value precision information has been defined.
Method HasXYPrecision Returns true when (x,y) precision information has been defined.
Method HasZPrecision Returns true when z-value precision information has been defined.
Method IsMPrecisionEqual Returns true if the measure precisions of the two spatial references are the same.
Method IsPrecisionEqual Returns TRUE when the precision information for the two spatial references is the same.
Method IsXYPrecisionEqual Returns true if the XY precisions of the two spatial references are the same.
Method IsZPrecisionEqual Returns true if the Z precisions of the two spatial references are the same.
Read-only property Name The name of this spatial reference component.
Read-only property PrecisionExImpl An opaque reference to the precision information (including z/m awareness) implementation for this spatial reference.
Read-only property PrecisionImpl An opaque reference to the precision information implementation for this spatial reference.
Read-only property Remarks The comment string of this spatial reference component.
Method SetDomain The XY domain extent.
Method SetFalseOriginAndUnits Set the false origin and units.
Method SetMDomain The measure domain extent.
Method SetMFalseOriginAndUnits Set the measure false origin and units.
Method SetZDomain The Z domain extent.
Method SetZFalseOriginAndUnits Set the Z false origin and units.
Read-only property SpatialReferenceImpl SpatialReferenceImpl.
Read/write property ZCoordinateUnit The unit for the Z coordinate.

ISpatialReference2.ApplyPrecision Method

Applies the measure and z value precisions.

Public Sub ApplyPrecision ( _
    ByVal cPoints As Integer, _
    ByRef Points As WKSPoint, _
    ByRef ms As Double, _
    ByRef zs As Double _
)
public void ApplyPrecision (
    int cPoints,
    ref WKSPoint Points,
    ref double ms,
    ref double zs
);

Description

The ApplyPrecision method snaps measure or z values to the spatial reference grid. Each SpatialReference has an extent and a resolution (1/precision) for the xy, z, and measure values. You can set this information with the SetZDomain, SetMDomain, SetZFalseOriginAndUnits or the SetMFalseOriginAndUnits methods. If you use a Domain method, the resolution (1/precision) is calculated from the given extent. The FalseOriginAndUnits methods sets the lower bound of the extent and explicitly defines the precision (units, or 1/resolution) of the spatial reference.

ISpatialReference2.ApplyXYPrecision Method

Applies the XY precision.

Public Sub ApplyXYPrecision ( _
    ByVal cPoints As Integer, _
    ByRef Points As WKSPoint _
)
public void ApplyXYPrecision (
    int cPoints,
    ref WKSPoint Points
);

Description

The ApplyXYPrecision method snaps XY coordinate values to the spatial reference's coordinate grid. Normally, the geodatabase calls this method when appropriate, however you may need to use it when comparing locally generated coordinates against features coming from a geodatabase.

Remarks

The cPoints value is the number of points to which you wish to apply the XY precision (1/resolution). A WKSPoint is a structure that contains the X and Y values of a coordinate pair.

ISpatialReference2.IsMPrecisionEqual Method

Returns true if the measure precisions of the two spatial references are the same.

Public Function IsMPrecisionEqual ( _
    ByVal otherSR As ISpatialReference _
) As Boolean
public bool IsMPrecisionEqual (
    ISpatialReference otherSR
);

Description

Compares the measure precisions (resolutions) . Both spatial references must be of the same type (both PCS, both GCS, etc).

Remarks

The IClone::IsEqual method for PCSs and GCSs compares only the projection information (projection, spheroid, projected units, etc.). It does not compare any properties related to the coordinate grid definition for the spatial references.

Use the ISpatialReference2.IsXY/Z/MPrecisionEqual methods to compare coordinate grid information.

Use the ISpatialReferenceTolerance.IsXY/Z/MToleranceEqual methods to compare the various cluster tolerances for the spatial references.

ISpatialReference2.IsXYPrecisionEqual Method

Returns true if the XY precisions of the two spatial references are the same.

Public Function IsXYPrecisionEqual ( _
    ByVal otherSR As ISpatialReference _
) As Boolean
public bool IsXYPrecisionEqual (
    ISpatialReference otherSR
);

Description

Compares the X and Y precision (resolution) values. Both spatial references must be of the same type (both GCS, both PCS, etc).

Remarks

The IClone::IsEqual method for PCSs and GCSs compares only the projection information (projection, spheroid, projected units, etc.). It does not compare any properties related to the coordinate grid definition for the spatial references.

Use the ISpatialReference2.IsXY/Z/MPrecisionEqual methods to compare coordinate grid information.

Use the ISpatialReferenceTolerance.IsXY/Z/MToleranceEqual methods to compare the various cluster tolerances for the spatial references.

ISpatialReference2.IsZPrecisionEqual Method

Returns true if the Z precisions of the two spatial references are the same.

Public Function IsZPrecisionEqual ( _
    ByVal otherSR As ISpatialReference _
) As Boolean
public bool IsZPrecisionEqual (
    ISpatialReference otherSR
);

Description

Compares the Z precisions (resolutions). Both srs must be of the same type (both GCS, both PCS, etc).

Remarks

The IClone::IsEqual method for PCSs and GCSs compares only the projection information (projection, spheroid, projected units, etc.). It does not compare any properties related to the coordinate grid definition for the spatial references.

Use the ISpatialReference2.IsXY/Z/MPrecisionEqual methods to compare coordinate grid information.

Use the ISpatialReferenceTolerance.IsXY/Z/MToleranceEqual methods to compare the various cluster tolerances for the spatial references.

Inherited Interfaces

Interfaces Description
ISpatialReference Provides access to members that control a SpatialReference.
ISpatialReferenceInfo Provides access to members that control the properties common to all components of a spatial reference system.

Classes that implement ISpatialReference2

Classes Description
GeographicCoordinateSystem Creates a geographic coordinate system.
ProjectedCoordinateSystem Creates a projected coordinate system.
UnknownCoordinateSystem Creates an unknown coordinate system.
public static bool CompareSpatialRefs2(ISpatialReference2 sourceSR, ISpatialReference2 targetSR)

        {

            IClone sClone = sourceSR as IClone;

            IClone tClone = targetSR as IClone;

            // first level test compares the coordinate system component

            if (!sClone.IsEqual(tClone))

                return false;

            // Can also check just Horizontal Coordinate System equality

            bool SREqual = true;

            ICompareCoordinateSystems compare = sourceSR as ICompareCoordinateSystems;

            compare.IsEqualNoVCS(targetSR, ref SREqual);

            if (!SREqual)

                return false;

            return true;

}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.