ArcGIS Server にアクセスする方法

バージョン 10 までの操作方法

Dim strUser As String = "ユーザ名"
Dim strPassword As String = "パスワード"
Dim strServer As String = "サーバ名"


Dim pID As ESRI.ArcGIS.ADF.Identity
pID = New ESRI.ArcGIS.ADF.Identity(strUser, strPassword, strServer)

Dim pAgsConn As ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection
pAgsConn = New ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(strServer, pID)
pAgsConn.Connect()

Dim pSOM As ESRI.ArcGIS.Server.IServerObjectManager
pSOM = pAgsConn.ServerObjectManager

Dim pSC As ESRI.ArcGIS.Server.IServerContext
pSC = pSOM.CreateServerContext("", "")

Dim pPropSet As ESRI.ArcGIS.esriSystem.IPropertySet
pPropSet = pSC.CreateObject("esriSystem.PropertySet")
pPropSet.SetProperty("SERVER", "pc-aaa")
pPropSet.SetProperty("INSTANCE", "5151")
pPropSet.SetProperty("USER", "test")
pPropSet.SetProperty("PASSWORD", "test001")
pPropSet.SetProperty("VERSION", "sde.DEFAULT")

'ArcSDEに接続
Dim pSdeWsFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory
pSdeWsFactory = pSC.CreateObject("esriDataSourcesGDB.SdeWorkspaceFactory")

Dim pFeatWs As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace
pFeatWs = pSdeWsFactory.Open(pPropSet, 0)



'編集開始
Dim pWsEdit As ESRI.ArcGIS.Geodatabase.IWorkspaceEdit
pWsEdit = pFeatWs
pWsEdit.StartEditing(False)
pWsEdit.StartEditOperation()




Dim pFClass As IFeatureClass = pFeatWs.OpenFeatureClass("TEST.輸送管")

Dim pFeature As IFeature = pFClass.GetFeature(7)
pFeature.Value(1) = "#AAAAA!"
pFeature.Store()


'編集終了
pWsEdit.StopEditOperation()
pWsEdit.StopEditing(True)

pSC.ReleaseContext()