ArcMap → [データ フレーム] プロパティ → [アノテーション グループ] 内の空間参照の取得、及び設定方法。
Sub GetSpatialReferenceOnTheAnnotationGroup()
Dim pMxDocument As IMxDocument
Set pMxDocument = Application.Document
Dim pMap As IMap
Set pMap = pMxDocument.FocusMap
Dim pCompositeGraphicsLayer As ICompositeGraphicsLayer
Set pCompositeGraphicsLayer = pMap.BasicGraphicsLayer
Dim pCompositeLayer As ICompositeLayer
Set pCompositeLayer = pCompositeGraphicsLayer
Debug.Print pCompositeLayer.Count ' レイヤー数
Dim pGeoDataset As IGeoDataset
Set pGeoDataset = pCompositeLayer
Debug.Print pGeoDataset.SpatialReference.Name '空間参照の確認
Dim pGeoDatasetSchemaEdit As IGeoDatasetSchemaEdit
Set pGeoDatasetSchemaEdit = pCompositeGraphicsLayer
pGeoDatasetSchemaEdit.AlterSpatialReference getSR '空間参照の変更
Debug.Print pGeoDataset.SpatialReference.Name '空間参照の確認
End Sub
Function getSR() As ISpatialReference
'例
Dim valType As Long
'valType = esriSRProjCS4Type.esriSRProjCS_JGD2000_Japan_Zone_9 'JGD2000 平面直角座標系第9系
valType = esriSRGeoCS3Type.esriSRGeoCS_JapanGeodeticDatum2000 'JGD2000 地理座標系
Dim pSpatialReferenceFactory As ISpatialReferenceFactory
Set pSpatialReferenceFactory = New SpatialReferenceEnvironment
Dim pGeographicCoordinateSystem As IGeographicCoordinateSystem
Set pGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(valType)
' Dim pProjectedCoordinateSystem As IProjectedCoordinateSystem
' Set pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(valType)
Set getSR = pGeographicCoordinateSystem
End Function