YouTube | Facebook | Twitter  Feed

ラスター レイヤーから断面を作成

2016/9/1 (木)

Sub GetInterpolateShapeFromRaster()
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
    Dim pRasterLayer As IRasterLayer
    Set pRasterLayer = pMxDocument.FocusMap.Layer(0)
     
    'Dim pRasterBandCollection As IRasterBandCollection
    'Set pRasterBandCollection = pRasterLayer.Raster
     
     
    Dim pRasterSurface As IRasterSurface
    Set pRasterSurface = New RasterSurface
    'pRasterSurface.RasterBand = pRasterBandCollection.Item(0)
    pRasterSurface.PutRaster pRasterLayer.Raster, 0 'Rasterからサーフェス用ラスタを取得
     
    Dim pSurface As ISurface
    Set pSurface = pRasterSurface
     
     
     
    Dim pEnumGeometry As IEnumGeometry
    Set pEnumGeometry = GetGraphicElements(pMxDocument.FocusMap)
     
    Dim pInputGeometry As IGeometry
    Set pInputGeometry = pEnumGeometry.Next
     
    Dim pInputCurve As ICurve
    Set pInputCurve = pInputGeometry
     
    Dim pInputCurve3D As ICurve3D
    Set pInputCurve3D = pInputGeometry
     
    Debug.Print "Input:", pInputCurve.Length
     
    Dim pOutGeometry As IGeometry
     
     
     
    Call pSurface.InterpolateShape(pInputGeometry, pOutGeometry)
     
    Dim pOutCurve3D As ICurve3D
    Set pOutCurve3D = pOutGeometry
     
    Debug.Print "Output:", pOutCurve3D.Length3D
 
End Sub
 
 
 
 
 
'グラフィックからすべてのジオメトリを取得
Public Function GetGraphicElements(GraphicsContainer As IGraphicsContainer) As IEnumGeometry
    GraphicsContainer.Reset
     
    Dim pElement As IElement
    Set pElement = GraphicsContainer.Next
     
    Dim pGeometryCollection As IGeometryCollection
    Set pGeometryCollection = New GeometryBag
     
    Do Until pElement Is Nothing
         
        pGeometryCollection.AddGeometry pElement.Geometry
         
        Set pElement = GraphicsContainer.Next
     
    Loop
     
    Set GetGraphicElements = pGeometryCollection
 
End Function

関連記事

  • この記事を書いた人

羽田 康祐

Esri認定インストラクター、GIS上級技術者、測量士補、潜水士。GISy / GISc とその関連分野である地理学・地図学について日々の出来事で学んだ記憶を記録するためにブログを書いています。行動原理は伊達と酔狂。好きな地形は圏谷。好きな地図投影法はパースクインカンシャル図法。呉市生まれ広島市出身。GIS を使った自己紹介はこちら

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

© 2020 WINGFIELD since1981