Private Sub ProjectCoordinates() Dim pSpatialReferenceFactory As ISpatialReferenceFactory Set pSpatialReferenceFactory = New SpatialReferenceEnvironment '変換前の空間参照(地理座標系:WGS1984) Dim pGeographicCoordinateSystem As IGeographicCoordinateSystem Set pGeographicCoordinateSystem = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_WGS1984) '変換後の空間参照(投影座標系:WGS1984 メルカトル) Dim pProjectedCoordinateSystem As IProjectedCoordinateSystem Set pProjectedCoordinateSystem = pSpatialReferenceFactory.CreateProjectedCoordinateSystem(esriSRProjCS_World_Mercator) Dim pPoint As IPoint Set pPoint = New point Set pPoint.SpatialReference = pGeographicCoordinateSystem 'SpatialReferenceの定義 pPoint.X = 139.61425781 pPoint.Y = 35.53222623 Debug.Print "変換前", pPoint.SpatialReference.Name, "X : " & pPoint.X, "Y : " & pPoint.Y pPoint.Project pProjectedCoordinateSystem '投影変換 Debug.Print "変換後", pPoint.SpatialReference.Name, "X : " & pPoint.X, "Y : " & pPoint.Y End Sub
IGeometryProject メソッドの使用方法
2016/9/1 (木)