This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IS > ISpatialReference Interface > ISpatialReference.GetFalseOriginAndUnits Method (ArcObjects .NET 10.5 SDK) |
Get the false origin and units.
[Visual Basic .NET] Public Sub GetFalseOriginAndUnits ( _ ByRef falseX As Double, _ ByRef falseY As Double, _ ByRef xyUnits As Double _ )
[C#] public void GetFalseOriginAndUnits ( ref double falseX, ref double falseY, ref double xyUnits );
[C++]
HRESULT GetFalseOriginAndUnits(
double* falseX,
double* falseY,
double* xyUnits
);
[C++]
Parameters falseX [out] falseX is a parameter of type double falseY [out] falseY is a parameter of type double xyUnits [out] xyUnits is a parameter of type double
An alternative method to the GetDomain method. The falseX and falseY values correspond to the minimum X and minimum Y values of the XY domain. The xyUnits is the same as the precision or scale value. The inverse of the xyUnits defines the resolution of the data stored in the geodatabase. The resolution is used to snap data when it is stored in the geodatabase.
The falseX, falseY, and xyUnits use the same unit of measure as the coordinate system.
Sample values if data is based on a geographic coordinate system are:
falseX=-180
falseY=-90
xyUnits=1000000
Sample values if data is based on a projected coordinate system are:
falseX=200000
falseY=4000000
xyUnits=100
In the first example, the data is using a geographic coordinate system so the falseX and falseY values are in degrees. The inverse of the xyUnits is 0.000001 degrees.
In the second example, the data is using a projected coordinate system. Let us assume that the unit of measure is meters. The smallest coordinates values that a feature can have is x=200000 meters and Y=4000000 meters. The inverse of the xyUnits is 0.01 (meters) which means data will be snapped to the closest centimeter when it is stored.
Use this function to retrieve the following information about the spatial reference of the geometry:
falseX: XMin of the domain.
falseY: YMin of the domain.
XYUnits: Precision of the domain.
//This code example shows how to get the false origin and units of a dataset
private void GetFalseOriginAndUnits(IFeatureClass featureClass)
{
IGeoDataset geoDataset=featureClass as IGeoDataset;
//get access to SpatialReference through IGeoDataset
ISpatialReference spatialReference=geoDataset.SpatialReference;
//get the false origin and units of the dataset
double falseX;
double falseY;
double xyUnits;
spatialReference.GetFalseOriginAndUnits(out falseX, out falseY, out xyUnits);
System.Windows.Forms.MessageBox.Show(falseX + ", " + falseY + ", " + xyUnits);
}
'This code example shows how to get the false origin and units of a dataset.
'This example assumes that a valid workspace object has already 'been established.
Sub GetFalseOriginAndUnits_Example(ByVal pWorkspace As IWorkspace)
Dim pFeatWS As IFeatureWorkspace
pFeatWS=pWorkspace
Dim pFeatDS As IFeatureDataset
pFeatDS=pFeatWS.OpenFeatureDataset("railroad")
Dim pGeoDataset As IGeoDataset
pGeoDataset=pFeatDS
'get access to SpatialReference through IGeoDataset
Dim pSpatRef As ISpatialReference
pSpatRef=pGeoDataset.SpatialReference
'declare variables that will be used to store the
'false origin and units of the dataset
Dim dFalseX As Double
Dim dFalseY As Double
Dim dXYUnits As Double
'get the false origin and units of the dataset
pSpatRef.GetFalseOriginAndUnits(dFalseX, dFalseY, dXYUnits)
Debug.Print(dFalseX & ", " & dFalseY & ", " & dXYUnits)
End Sub