The spatial reference of the GeoDataset.
[Visual Basic 6.0] Property SpatialReference As ISpatialReference
[Visual Basic .NET] Public ReadOnly Property SpatialReference As ISpatialReference
[C#] public ISpatialReference SpatialReference {get;}
[Java] public ISpatialReference getSpatialReference() throws IOException, AutomationException
[C++] HRESULT get_SpatialReference( ISpatialReference** spref );
This property is read only. For layers, when the first layer is added to ArcMap, its spatial reference is read by this property, and the map is set to this spatial reference.
The following code reports the name of the spatial reference of the layer.
Sub ReportSpatRef()
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pLayer As IGeoDataset
Dim pSpatRef As ISpatialReference
Set pMxDoc = Application.Document
Set pMap = pMxDoc.FocusMap
Set pLayer = pMap.Layer(0)
Set pSpatRef = pLayer.SpatialReference
MsgBox pSpatRef.Name
End Sub