'1. ArcCatalogの検索で指定のフォルダからメタデータを設定したい対象のフィーチャクラスを絞り込み検索 '2. 検索結果をカタログ ツリーで選択し、マクロを実行 Private Const XMLFile As String = "D:\metadata.xml" 'インポートするメタデータのフルパス Public Sub CopyMetadataFromXML() Dim pGxApplication As IGxApplication Dim pGxObjectContainer As IGxObjectContainer Dim pEnumGxObject As IEnumGxObject Dim pGxObject As IGxObject Dim pGxObject1 As IGxObject Dim pMetadata As IMetadata Dim pMetadataImport As IMetadataImport Set pGxApplication = Application Set pGxObject = pGxApplication.SelectedObject If Not TypeOf pGxObject Is ISearchResults Then MsgBox "Please select a 検索結果", vbExclamation Exit Sub Else Set pGxObjectContainer = pGxObject 'Check to see if there are children Set pEnumGxObject = pGxObjectContainer.Children If pEnumGxObject Is Nothing Then MsgBox "Nothing was found in the " & pEnumGxObject.FullName & " Folder" Exit Sub Else 'For each object that is in the Folder, import the XML document as metadata Set pGxObject1 = pEnumGxObject.Next Dim intCount As Integer Do While Not pGxObject1 Is Nothing Dim strName As String strName = pGxObject1.Name Set pMetadata = pGxObject1 Set pMetadataImport = New ImportXML 'Import a local xml document to metadata pMetadataImport.Import XMLFile, pMetadata Set pGxObject1 = pEnumGxObject.Next intCount = intCount + 1 Loop End If End If MsgBox "よくがんばっている!" End Sub
IMetadataImport を使用したメタデータの一括インポート
2016/9/1 (木)