YouTube | Facebook | X(Twitter) | RSS

トポロジの構築

2016/9/1 (木)

Public Sub CreateTopology()
 
Dim pWSFact As IWorkspaceFactory
Set pWSFact = New AccessWorkspaceFactory
 
Dim pWor As IWorkspace
Set pWor = pWSFact.OpenFromFile("D:\WorkSpace\Personal Geodatabase.mdb", 0)
 
Dim pFWS As IFeatureWorkspace
Set pFWS = pWor
 
Dim pDS As IDataset
Set pDS = pFWS.OpenFeatureDataset("Dataset")
 
Dim pTopoCont As ITopologyContainer
Set pTopoCont = pDS
 
'Create the topology
Dim pTopo As ITopology
Set pTopo = pTopoCont.CreateTopology("Topology", pTopoCont.DefaultClusterTolerance, -1, "")
 
Dim pFCC As IFeatureClassContainer
Set pFCC = pDS
 
Dim pFC As IFeatureClass
Set pFC = pFCC.ClassByName("Roads")
 
'Add the feature class to the topology
pTopo.AddClass pFC, 5, 1, 1, False
 
'Create the first rule
Dim pRule As ITopologyRule
Dim pRuleCont As ITopologyRuleContainer
Set pRule = New TopologyRule
pRule.TopologyRuleType = esriTRTLineNoOverlap
pRule.OriginClassID = pFC.ObjectClassID
pRule.AllOriginSubtypes = True
pRule.Name = "Roads No Overlap"
 
'Add the rule to the topology
Set pRuleCont = pTopo
pRuleCont.AddRule pRule
 
'Create the second rule
Set pRule = New TopologyRule
pRule.TopologyRuleType = esriTRTLineNoDangles
pRule.OriginClassID = pFC.ObjectClassID
pRule.AllOriginSubtypes = True
pRule.Name = "Roads No Dangles"
 
'Add the rule to the topology
If pRuleCont.CanAddRule(pRule) Then pRuleCont.AddRule pRule
 
End Sub
  • この記事を書いた人

羽田 康祐

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

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