NTv2 による TKY2JGD 変換

'NTv2Transformationによる座標変換
Public Sub GetGeographicTransformations()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
    
    Dim pMap As IMap
    Set pMap = pMxDocument.FocusMap
    
    'NTv2Transformationの作成
    Dim pNewGeoTransformation As IGeoTransformation
    Set pNewGeoTransformation = CreateTKY2JGD_NTv2Transformation
    
    '任意の空間参照を作成
    Dim pSpatialReferenceFactory As ISpatialReferenceFactory
    Set pSpatialReferenceFactory = New SpatialReferenceEnvironment
    
    Dim pGCS_Tokyo As ISpatialReference
    Set pGCS_Tokyo = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(esriSRProjCS_TokyoJapan9) ' 地理座標系(測地基準系)を考慮した投影変換
    
    Dim pGCS_JGD2000 As ISpatialReference
    Set pGCS_JGD2000 = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(esriSRProjCS_JGD2000_Japan_Zone_9)
    
    Dim pPoint As IPoint
    Set pPoint = New Point
    pPoint.PutCoords 34235.133, 193524.0771
    Set pPoint.SpatialReference = pGCS_Tokyo
    
    Debug.Print pGCS_Tokyo.Name, pPoint.x, pPoint.y
    
    Dim pGeometry As IGeometry2
    Set pGeometry = pPoint
    pGeometry.ProjectEx pGCS_JGD2000, esriTransformForward, pNewGeoTransformation, False, 0, 0

    Debug.Print pGCS_JGD2000.Name, pPoint.x, pPoint.y
    
End Sub

'NTv2Transformation(TKY2JGD)の作成
Public Function CreateTKY2JGD_NTv2Transformation() As IGridTransformation
    Dim pGridTransformation As IGridTransformation
    Set pGridTransformation = New NTv2Transformation
    
    pGridTransformation.Name = "Tokyo_To_JGD2000_TKY2JGD"
    pGridTransformation.GridDatasetName = "japan\tky2jgd.gsb"
    pGridTransformation.Load
    
    Set CreateTKY2JGD_NTv2Transformation = pGridTransformation

End Function