This document is archived and information here might be outdated.  Recommended version.


ISpatialReference.SetDomain Method (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Geometry)  

ISpatialReference.SetDomain Method

The XY domain extent.

[Visual Basic .NET]
Public Sub SetDomain ( _
    ByVal XMin As Double, _
    ByVal XMax As Double, _
    ByVal YMin As Double, _
    ByVal YMax As Double _
)
[C#]
public void SetDomain (
    double XMin,
    double XMax,
    double YMin,
    double YMax
);
[C++]
HRESULT SetDomain(
  double XMin,
  double XMax,
  double YMin,
  double YMax
);
[C++]

Parameters XMin [in]
XMin is a parameter of type double XMax [in]
XMax is a parameter of type double YMin [in]
YMin is a parameter of type double YMax [in]
YMax is a parameter of type double

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

An alternative method to the SetFalseOriginAndUnits method. Sets the minimum and maximum allowed X and Y values for a spatial reference. A resolution is then calculated from these extremes. Use SetFalseOriginAndUnits to set explicitly the desired scale factor (1.0/resolution) value.

Remarks

The xy domain must be square. If you set a wider X or Y extent, it will take precedence. For example, let's say you set these values:

XMin=-180

XMax=180

YMin=-90

YMax=90

If you then query the values with GetDomain, you will see that the YMax value is 270. That is because the X extent is 360, so the Y extent must also be 360. The minimum x and y values are always maintained.

When creating a new spatial reference with a projected or geographic coordinate system, the recommended method for defining the XY Domain is ISpatialReferenceResolution::ConstructFromHorizon, followed by ISpatialReferenceResolution::SetDefaultXYResolution and ISpatialReferenceTolerance::SetDefaultXYTolerance. These methods produce a valid domain that covers the valid coordinate range for the coordinate system and reasonable resolution and tolerance values. The default XY tolerance value is 1 mm or its equivalent based on the coordinate system's unit of measure. The default XY resolution value is 0.1 mm or its equivalent. Tolerance values must be at least two times as large as the resolution value.

[C#]     //This code example shows how to set the xy domain extent of a dataset.
    private void SetSpatialReferenceProperties(IFeatureClass featureClass)
    {
        IGeoDataset geoDataset=featureClass as IGeoDataset;
        //get access to SpatialReference through IGeoDataset
        ISpatialReference spatialReference=geoDataset.SpatialReference;
        //set the xy domain extent for the dataset
        spatialReference.SetDomain(10000, 90000, 10000, 90000);
    }

See Also

ISpatialReference Interface | ISpatialReferenceResolution Interface