ArcObjects Library Reference (Geometry)  

ISpatialReference Interface

Provides access to members that control a SpatialReference. Note: the ISpatialReference interface has been superseded byISpatialReference3. Please consider using the more recent version.

Product Availability

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

Description

The spatial reference is not defined when creating a new instance of a geometry. It is the developer's responsibility to define a spatial reference that makes sense for the geometry and for the operation. To achieve precise and predictable results using the geometry library, it is essential that the spatial reference of geometries within a workflow is well defined. When performing a spatial operation using two or more geometries, for example an intersection, the coordinate systems of the two geometries must be equal. If the coordinate systems of the geometries are different or undefined, the operation could produce unexpected results.

Members

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 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 IsPrecisionEqual Returns TRUE when the precision information for the two spatial references is the same.
Read-only property Name The name of this spatial reference component.
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/write property ZCoordinateUnit The unit for the Z coordinate.

Inherited Interfaces

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

CoClasses that implement ISpatialReference

CoClasses and Classes Description
GeographicCoordinateSystem Creates a geographic coordinate system.
ProjectedCoordinateSystem Creates a projected coordinate system.
UnknownCoordinateSystem Creates an unknown coordinate system.
[C#]

The following code demonstrates how to compare two spatial references.  There are two ways shown in the example one using IClone and the other using ICompareSpatialReferences and the IsEqualNoVCS method

 

        public static bool CompareSpatialRefs(ISpatialReference sourceSR, ISpatialReference 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;
            
            return true;
        }

 

.NET Snippets

Zoom to Selected Globe Features | Set Max Extent On Spatial Domain | Convert Spatial Reference From Low To High Precision | Create High Precision Spatial Reference | Convert Spatial Reference From High To Low Precision | Create Grid From Feature Class | Create Test Polyline from Geometry Environment | Create Low Precision Spatial Reference | Change Map Spatial Reference | Get Spatial Reference from Dataset | Make Spatial Reference |

.NET Samples

ArcGIS GPConsole (Code Files: Program) | Clonable object (Code Files: ClonableObjClass TestClass) | Closest facility application using the NAServer extension in ArcGIS Server via a GIS server (Code Files: ClosestFacility_GISServerAPIClass) | Create a custom raster type (Code Files: TestThumbnailBuilder) | Create a Mosaic dataset (Code Files: CreateMosaicDataset) | Create a raster catalog using the geoprocessor (Code Files: CreateRasterCatalog_GP) | Create camera flyby from path (Code Files: frmCameraPath) | Creating a toolbar of globe tools (Code Files: PointGeometry PolygonGeometry PolylineGeometry SpatialReference) | Curve conversion add-in (Code Files: CurveConversionDockWin) | Custom map selection commands (Code Files: SelectFeatures) | Find the closest intersection from a point (Code Files: FindClosestIntersection) | Implementing a schematic digitizing tool (Code Files: DigitTool) | Implementing a schematic layout algorithm and its layout property page (Code Files: TranslateTree) | Move a graphic along a path in ArcMap (Code Files: AnimationUtils) | Route application using the NAServer extension in ArcGIS Server via a GIS client (Code Files: Route_GISClientClass) | Route application using the NAServer extension in ArcGIS Server via a GIS server (Code Files: Route_GISServerAPIClass) | RSS weather GraphicTracker (Code Files: RSSWeather) | RSS weather layer (Code Files: AddWeatherItemTool RSSWeatherLayerClass) | Service area application using the NAServer extension in ArcGIS Server via a GIS server (Code Files: ServiceArea_GISServerAPIClass) | Simple point plug-in data source (Code Files: SimplePointDataset) | StreetMap routing (Code Files: RoutingForm) | Triangle graphic element (Code Files: TriangleElementClass) |

.NET Related Topics

Calling the Simplify method | Checking for topology error features in a geodatabase topology | Converting between high- and low-precision spatial references | Creating a plug-in data source | Creating a predefined geotransformation | Creating annotation and dimension feature classes | Creating feature classes | Creating feature datasets | Creating fields | DataSourcesRaster | DefenseSolutions | Executing spatial queries | GeoAnalyst | Geodetic curve support in the ArcObjects Geometry API | Geometry | Geometry service | Geoprocessing services | How to convert coordinate arrays | How to convert MGRS (Indian 1960) to DMS and DD | How to create a Mosaic dataset | How to create a raster dataset | How to create a referenced mosaic dataset | How to create an AdjustXform for georeferencing images | How to import or export a spatial reference | How to project a raster with a datum transformation | How to snap a point to a coordinate grid | How to use the IAffineTransformation2D project and MoveOrigin methods | How to zoom to selected features in globe | Implementing persistence | Using ArcObjects as tool input | Working with GeometryEnvironment | Working with the analysis environment | Writing .NET code using properties |