ArcObjects Library Reference  (GeoDatabase)    

IGeoDataset.SpatialReference Property

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
);
[C++]

Parameters

spref [out, retval]

  spref is a parameter of type ISpatialReference

Product Availability

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

Remarks

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.

[Visual Basic 6.0]

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

See Also

IGeoDataset Interface

Example

IGeoDataset SpatialReference Example

 


Feedback Send feedback on this page