[Visual Basic 6.0]The following code reports the name of the spatial reference of a layer:
Sub ReportSpatRef() Dim pMxDoc as IMxDocument Dim pMap as IMap Dim pGeoDataset as IGeoDataset Dim pSpatRef as ISpatialReference Set pMxDoc = Application.Document Set pMap = pMxDoc.FocusMap Set pGeoDataset = pMap.Layer(0) Set pSpatRef = pGeoDataset.SpatialReference MsgBox pSpatRef.Name End Sub
[C#]//IGeoDataset SpatialReference Example
public void IGeoDataset_SpatialReference_Example(IFeatureClass featureClass)
{
//This function reports the name of spatial reference for a feature class
IGeoDataset geoDataset = (IGeoDataset)featureClass;
ESRI.ArcGIS.Geometry.ISpatialReference spatialReference = geoDataset.SpatialReference;
Console.WriteLine("The featureClass {0} has a spatial reference named {1}", featureClass.AliasName, spatialReference.Name);
}
[Visual Basic .NET, C++]
No example is available for Visual Basic .NET or C++. To view a Visual Basic 6.0 or C# example, click the Language Filter button
in the upper-left corner of the page.