| Development licensing |
Deployment licensing |
| ArcView |
ArcView |
| ArcEditor |
ArcEditor |
| ArcInfo |
ArcInfo |
| Engine Developer Kit |
Engine Runtime |
Converting between high and low precision spatial references
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);
ISpatialReferenceFactory3 spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
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)
Dim spatialReferenceFactory As ISpatialReferenceFactory3 = New SpatialReferenceEnvironmentClass()
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:
How to construct a high or low precision spatial reference