YouTube | Facebook | X(Twitter) | RSS

テーブル結合の解除

2016/9/1 (木)

'http://gis.stackexchange.com/questions/11088/how-do-i-remove-a-join-between-a-standalone-table-and-a-feature-layer-with-arc
 
'VBA ヘルプにサンプルが記載
'Samples > Tables >
'How to remove all joins from a layer or table in ArcMap
Sub RemoveAllJoins()
 
  On Error GoTo EH
 
  Dim pMxDocument As IMxDocument
  Set pMxDocument = ThisDocument
   
  Dim pMap As IMap
  Set pMap = pMxDocument.FocusMap
   
  ' 選択レイヤー、もしくは テーブルを取得
  Dim pSelectedItem As IUnknown
  Set pSelectedItem = pMxDocument.SelectedItem
   
  If pSelectedItem Is Nothing Then
    MsgBox "コンテンツ ウィンドウで何も選択されていません。"
    Exit Sub
  End If
  If Not (TypeOf pSelectedItem Is ILayer Or TypeOf pSelectedItem Is IStandaloneTable) Then
    MsgBox "コンテンツ ウィンドウでフィーチャ レイヤ/テーブルが選択されていません。"
    Exit Sub
  End If
   
  Dim pDisplayRelationshipClass As IDisplayRelationshipClass
  Set pDisplayRelationshipClass = pSelectedItem
     
  ' すべての空間結合を削除
  If pDisplayRelationshipClass.RelationshipClass Is Nothing Then
    MsgBox "レイヤ/テーブルは結合されていません"
    Exit Sub
  End If
   
  Call pDisplayRelationshipClass.DisplayRelationshipClass(Nothing, esriLeftInnerJoin)
 
  Exit Sub
EH:
    
  MsgBox Err.Number & "  " & Err.Description
    
End Sub
 
 
'Samples > Tables >
'How to remove the last join from a layer or table in ArcMap

関連記事

  • この記事を書いた人

羽田 康祐

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

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

WINGFIELD since1981をもっと見る

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

続きを読む