マップ サービス レイヤーを追加

      2017/12/09

Sub test()
    Dim pGxApplication As IGxApplication
    Set pGxApplication = Application
     
    Dim pMxDocument As IMxDocument
    Set pMxDocument = ThisDocument
     
     
    Dim pGxObject As IGxObject
    Set pGxObject = pGxApplication.SelectedObject
     
    If TypeOf pGxObject Is IGxAGSMap Then
        'マップ サービス
        Dim agsObject3 As IGxAGSObject3
        Set agsObject3 = pGxObject
         
    '    Dim pMapServer As IMapServer
    '    set pmapserver = agsObject3.
         
        Dim pLayerFactory As ILayerFactory
        Set pLayerFactory = New MapServerLayerFactory
         
        'ArcGSI Server マップ サービスの場合
'        Dim pMapServerLayer As IMapServerLayer
'        Set pMapServerLayer = New MapServerLayer
'
'        Call pMapServerLayer.ServerConnect(agsObject3.AGSServerObjectName, agsObject3.AGSServerObjectName.Name)
'        Call pMxDocument.FocusMap.AddLayer(pMapServerLayer)
         
        'ArcGIS Online マップ サービスの場合
        Dim pMapServerRESTLayer As IMapServerRESTLayer
        Set pMapServerRESTLayer = New MapServerRESTLayer
        Call pMapServerRESTLayer.Connect(agsObject3.AGSServerObjectName.URL)
        Call pMxDocument.FocusMap.AddLayer(pMapServerRESTLayer)
         
     
    ElseIf TypeOf pGxObject Is IGxAGSFeatureServer Then
        'フィーチャ サービス
     
        Debug.Print 1
     
    End If
 
End Sub

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