YouTube | Facebook | Twitter  Feed

測地線に基づく距離の計測

2016/9/1 (木)

Public Sub Test()
    Dim pSpatialReferenceFactory As ISpatialReferenceFactory2
    Set pSpatialReferenceFactory = New SpatialReferenceEnvironment
     
    '地理座標系(WGS84)の定義
    Dim pSpatialReference As ISpatialReference
    Set pSpatialReference = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(4326) 'WGS84
     
    Dim pPointFrom As IPoint
    Set pPointFrom = New Point
    pPointFrom.PutCoords 0, 45
     
    Dim pPointTo As IPoint
    Set pPointTo = New Point
    pPointTo.PutCoords 1, 45
     
     
'    'Polyline の定義
'    Dim pPolyline As IPolyline
'    Set pPolyline = New Polyline
'    Set pPolyline.SpatialReference = pSpatialReference
'
'    Dim pPointCollection As IPointCollection
'    Set pPointCollection = pPolyline
'    pPointCollection.AddPoint pPointFrom
'    pPointCollection.AddPoint pPointTo
     
'    Dim pPolylineArray As IPolylineArray
'    Set pPolylineArray = New PolylineArray
'    pPolylineArray.Add pPointCollection
 
    '距離単位の定義
    Dim pLinearUnit As ILinearUnit
    Set pLinearUnit = New LinearUnit
    Dim pLinearUnitEdit As ILinearUnitEdit
    Set pLinearUnitEdit = pLinearUnit
    pLinearUnitEdit.Define "Meter", "", "", "", 1
     
    Dim pGeometryServer As IGeometryServer3
    Set pGeometryServer = New GeometryServer
     
'    Dim pDoubleArray As IDoubleArray
'    Set pDoubleArray = pGeometryServer.GetLengthsGeodesic(pSpatialReference, pPolylineArray, pLinearUnit)
'
'    '距離の出力
'    Debug.Print pDoubleArray.Element(0)
     
     
    Debug.Print pGeometryServer.GetDistanceGeodesic(pSpatialReference, pPointFrom, pPointTo, pLinearUnit)
 
End Sub

関連記事

  • この記事を書いた人

羽田 康祐

Twitter#一日一図法を連載中。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、元PADIダイブマスター、四アマ。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、発言は個人の見解です。

-プログラミング, ArcGIS
-,