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


IMap.SpatialReference Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Carto > ESRI.ArcGIS.Carto > Interfaces > IM > IMap Interface > IMap.SpatialReference Property
ArcGIS Developer Help

IMap.SpatialReference Property

The spatial reference of the map.

[Visual Basic .NET]
Public Property SpatialReference As ISpatialReference
[C#]
public ISpatialReference SpatialReference {get; set;}
[C++]
HRESULT get_SpatialReference(
  ISpatialReference** spatialRef
);
[C++]
HRESULT putref_SpatialReference(
  ISpatialReference* spatialRef
);
[C++]
Parameters
spatialRef [out, retval]

spatialRef is a parameter of type ISpatialReference** spatialRef [in]
spatialRef is a parameter of type ISpatialReference*

Product Availability

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

Remarks

When the SpatialReference property is set, the Map's MapUnits and DistanceUnits properties are set and the extent of the screen display is recalculated.
AddLayer automatically attempts to set the Map's SpatialReference property if a coordinate system has not yet been defined for the map.  When multiple layers are added simultaneously, AddLayer uses the first spatial reference it finds.
If no layers have a spatial reference, AddLayer checks the extent of the first layer (ILayer::AreaOfInterest) and if it has coordinates that look like geographic coordinates (XMin >= -180 and XMax <= 180 and YMin >= -90 and YMax <= 90), ArcMap assumes the data is in decimal degrees and sets the MapUnits to esriDecimalDegrees and DistanceUnits to esriMiles.
If no spatial reference is found and the coordinates do not look like geographic coordinates, ArcMap sets no spatial reference and sets the MapUnits to esriMeters and the DistanceUnits to esriMeters as well.

See Also

IMap Interface