Index . 블로그창고 . Any comments?

\cat gis, arcgis, programming

Choose a raster
Calculate areas of a shape file

Choose a raster

Private Sub UIButtonControl1_Click()

Dim pApp As IApplication
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer

Dim pLayers() As ILayer
Dim i As Integer

Dim pListDlg As IListDialog
Dim boolOK As Boolean

Dim pRasterLayer As IRasterLayer
Dim pRaster As IRaster

Set pApp = Application
Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap

i = 0
ReDim pLayers(pMap.LayerCount)
Set pEnumLayer = pMap.Layers
Set pLayer = pEnumLayer.Next
Set pListDlg = New ListDialog

pEnumLayer.Reset
Do While Not pLayer Is Nothing
    If TypeOf pLayer Is IRasterLayer Then
        pListDlg.AddString pLayer.Name
        Set pLayers(i) = pLayer
        i = 1
    End If
    Set pLayer = pEnumLayer.Next
Loop

If i = 0 Then
    Exit Sub
End If

boolOK = pListDlg.DoModal("Choose a DEM", 0, pApp.hWnd)
If boolOK = False Then
    Exit Sub
End If

Set pLayer = pLayers(pListDlg.Choice)
Set pRasterLayer = pLayer

MsgBox pRasterLayer.Name

End Sub

Calculate areas of a shape file

Private Sub UIButtonControl1_Click()

Dim pD As IMxDocument
Set pD = Application.Document

Dim pM As IMap
Set pM = pD.FocusMap

Dim pFL As IFeatureLayer
Set pFL = pM.Layer(0)

Dim pFCur As IFeatureCursor
Set pFCur = pFL.FeatureClass.Search(Nothing, False)

Dim pF As IFeature
Set pF = pFCur.NextFeature

Dim pA As IArea

Do Until pF Is Nothing
    Set pA = pF.Shape
    pF.Value(pF.Fields.FindField("Area")) = pA.Area
    pF.Store
    Set pF = pFCur.NextFeature
Loop

End Sub

All the works in this site except software and copyrighted materials by others (e.g., 문학) are licensed under a Creative Commons License. 소프트웨어 및 문학과 같이 다른 이에게 저작권이 있는 작품을 제외하고 모두 크리에이티브 커먼즈 라이센스를 따른다.
Tue Oct 12 09:05:58 2021 . XHTML . CSS (lightbox.css is not part of Uniqki. ;-) . Powered by Uniqki!
refresh . edit . loginout . index