YouTube | Facebook | X(Twitter) | RSS

メタデータの取得

2016/9/1 (木)

'メタデータの取得
Public Sub GetMetadata()
 
    Dim pGxApplication As IGxApplication
    Set pGxApplication = Application
     
    Dim pGxObject As IGxObject
    Set pGxObject = pGxApplication.SelectedObject
     
    Dim pMetadata As IMetadata
    Set pMetadata = pGxObject
     
    Dim pXmlPropertySet As IXmlPropertySet2
    Set pXmlPropertySet = pMetadata.Metadata
     
    Dim strXML As String
    strXML = pXmlPropertySet.GetXml("")
     
    'ファイルに保存
    'Debug.Print strXML
    '
    'Open "G:\TESTFILE.xml" For Output As #1        ' シーケンシャル出力モードでファイルを開きます。
    'Write #1, strXML
    'Close #1
 
    'ファイルに保存したXMLを元にXPathを求めて該当の値を取得
    'Debug.Print pXmlPropertySet.CountX("dataIdInfo/idAbs")
    Debug.Print pXmlPropertySet.SimpleGetProperty("dataIdInfo/idPurp")  'サマリ
    Debug.Print pXmlPropertySet.SimpleGetProperty("dataIdInfo/idAbs")   '説明
 
 
    'Dim pPS As IPropertySet
    'Set pPS = pXmlPropertySet
    '
    '    'retrieve all names and values for the PropertySet
    '    pPS.GetAllProperties vName, vValue
    '
    '    'Displays only the first ten Element Names
    '    For Each v In vName
    '        strNames(i) = CVar(v)
    '        i = i + 1
    '        If i = 10 Then
    '            Exit For
    '        End If
    '    Next
    '    i = 0
    '
    '    'Display only the first ten Element Values
    '    For Each v In vValue
    '        strValues(i) = CVar(v)
    '        i = i + 1
    '        If i = 10 Then
    '            Exit For
    '        End If
    '    Next
    '    i = 0
    '
    '    strFinal = "Names: Values" & vbNewLine
    '    For Each v In vValue
    '            strFinal = strFinal & strNames(i) & ": " & strValues(i) & vbNewLine
    '            i = i + 1
    '        If i = 10 Then
    '            Exit For
    '        End If
    '    Next
    '    MsgBox strFinal
 
End Sub

関連記事

  • この記事を書いた人

羽田 康祐

伊達と酔狂のGISエンジニア。GIS上級技術者、Esri認定インストラクター、CompTIA CTT+ Classroom Trainer、潜水士、PADIダイブマスター、四アマ。WordPress は 2.1 からのユーザーで歴だけは長い。 代表著書『地図リテラシー入門―地図の正しい読み方・描き方がわかる』 GIS を使った自己紹介はこちら。ESRIジャパン(株)所属、元青山学院大学非常勤講師を兼務。日本地図学会第31期常任委員。発言は個人の見解です。

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

WINGFIELD since1981をもっと見る

今すぐ購読し、続きを読んで、すべてのアーカイブにアクセスしましょう。

続きを読む