Converting between high- and low-precision spatial references (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with spatial references > Converting between high- and low-precision spatial references (ArcObjects .NET 10.6 SDK)

Converting between high- and low-precision spatial references


Summary
This topic shows how to convert a low-precision spatial reference (pre-9.2) to a high-precision spatial reference.

About converting between high- and low-precision spatial references

Each feature dataset or stand-alone feature class in a geodatabase has a coordinate grid. Coordinate values are snapped to the grid when added or edited. The grid's extent is called the x,y domain while the cell spacing is the x,y resolution. Z and measure values also have a spatial domain and resolution values. Before ArcGIS 9.2, geodatabases used a basic or low-precision model. A grid's precision was 1/resolution. At ArcGIS 9.2, a high-precision model was introduced. If you have to work with data that is at ArcGIS 9.1 or earlier, you might need to convert spatial reference values between the two precision models.
For more information on the spatial reference, see Understanding Coordinate Management in the Geodatabase.
The following code example shows how to convert between high- and low-precision spatial references:
[C#]
private void LowHighConversion_Example(IFeatureClass pre92FeatureClass)
{
    IGeoDataset pre92GeoDataset=pre92FeatureClass as IGeoDataset;
    ISpatialReference pre92SpatialReference=pre92GeoDataset.SpatialReference;

    double falseX;
    double falseY;
    double xyUnits;
    pre92SpatialReference.GetFalseOriginAndUnits(out falseX, out falseY, out xyUnits)
        ;

    System.Windows.Forms.MessageBox.Show(
        "Low precision coordinate grid definition:\n" + "false x: " + falseX + 
        ", false y: " + falseY + ", scale factor: " + xyUnits);

    // Set up the SpatialReferenceEnvironment.
    // SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.

    Type factoryType=Type.GetTypeFromProgID(
        "esriGeometry.SpatialReferenceEnvironment");
    System.Object obj=Activator.CreateInstance(factoryType);
    ISpatialReferenceFactory3 spatialReferenceFactory=obj as
        ISpatialReferenceFactory3;

    ISpatialReference spatialReference92 =
        spatialReferenceFactory.ConstructHighPrecisionSpatialReference
        (pre92SpatialReference,  - 1,  - 1,  - 1);

    spatialReference92.GetFalseOriginAndUnits(out falseX, out falseY, out xyUnits);
    System.Windows.Forms.MessageBox.Show(
        "high precision coordinate grid definition:\n" + "false x: " + falseX + 
        ", false y: " + falseY + ", scale factor: " + xyUnits);
}
[VB.NET]
Private Sub LowHighConversion_Example(ByVal pre92FeatureClass As IFeatureClass)
    Dim pre92GeoDataset As IGeoDataset=CType(pre92FeatureClass, IGeoDataset)
    
    Dim pre92SpatialReference As ISpatialReference=pre92GeoDataset.SpatialReference
    
    Dim falseX As Double, falseY As Double, xyUnits As Double
    pre92SpatialReference.GetFalseOriginAndUnits(falseX, falseY, xyUnits)
    
    System.Windows.Forms.MessageBox.Show("Low precision coordinate grid definition:" & ControlChars.NewLine & _
                                         "false x: " & falseX & ", false y: " & falseY & ", scale factor: " & xyUnits)
    
    ' Set up the SpatialReferenceEnvironment.
    ' SpatialReferenceEnvironment is a singleton object and needs to use the Activator class.
    
    Dim factoryType As Type=Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment")
    Dim spatialReferenceFactory As ISpatialReferenceFactory3=CType(Activator.CreateInstance(factoryType), ISpatialReferenceFactory3)
    
    Dim spatialReference92 As ISpatialReference=_
                                                  spatialReferenceFactory.ConstructHighPrecisionSpatialReference(pre92SpatialReference, -1, -1, -1)
    spatialReference92.GetFalseOriginAndUnits(falseX, falseY, xyUnits)
    
    System.Windows.Forms.MessageBox.Show("High precision coordinate grid definition:" & ControlChars.NewLine & _
                                         "false x: " & falseX & ", false y: " & falseY & ", scale factor: " & xyUnits)
End Sub


See Also:

Constructing a high- or low-precision spatial reference




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Basic ArcGIS Desktop Basic
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine