불행히도 클래스별로 요청을 동적으로 만들 수있는 방법이 없습니다. fdl 파일을 통해 프로그래밍해야합니다. WFS와 같은 서비스를 추가하려면 아래 코드를 사용하십시오.
IWorkspaceFactory factory = (IWorkspaceFactory)new FMEWorkspaceFactoryClass();
IFeatureWorkspace workspace = (IFeatureWorkspace)factory.OpenFromFile("d:\test", 0);
IFeatureDataset fds = workspace.OpenFeatureDataset("name.fdl");
건배!
PS : IWFSServer 인터페이스 를 사용해 보셨습니까 ? 이전 프로젝트 중 하나에서 DI 기능을 사용하여 QuickExport를 사용하여 데이터를 GML 형식으로 내보냈습니다 . 빠른 가져 오기를 사용 하고 소스로 WFS를 선택할 수 있습니다 . 참조를 위해 QuickExport 코드를 사용하고 있습니다 ...
Friend Sub Export2GML()
Dim pGPMessages As IGPMessages
'Dim pGPMessage As IGPMessage
Dim pGPEnvMgr As IGPEnvironmentManager
Dim pGPEnv_CoordSys As IGPEnvironment
Dim pGPEnv_Extent As IGPEnvironment
Dim pGPCOMHelper As IGPComHelper
Dim pGPToolbox As IGPToolbox
Dim pGPTool As IGPTool
Dim pParameter As IGPParameter
Dim pParameterEdit As IGPParameterEdit
Dim pDataType As IGPDataType
Dim pToolboxWorkspaceFactory As IWorkspaceFactory
Dim pToolboxWorkspace As IToolboxWorkspace
Dim pParamArray As IArray = New ArrayClass
Dim pProgressTracker As ITrackCancel
Dim pDSNames As IEnumDatasetName
Dim pDSN As IDatasetName
Dim TempWSPath As String = String.Empty
Dim Inv_Layer_Names As String = String.Empty
Try
OS_Layer_Names = String.Empty
'Get all layer names from the scratch PGDB
TempWSPath = pTempWS.PathName
pDSNames = pTempWS.DatasetNames(esriDatasetType.esriDTFeatureClass)
pDSNames.Reset()
pDSN = pDSNames.Next
While Not pDSN Is Nothing
If pDSN.Name.Contains("X") Or pDSN.Name.Contains("Y") Then
'If pDSN.Name.Contains("_OS") Then
' OS Layers present, export them seperately
OS_Layer_Names &= TempWSPath & "\" & pDSN.Name & "; "
Else
' Inventory layer
Inv_Layer_Names &= TempWSPath & "\" & pDSN.Name & "; "
End If
pDSN = pDSNames.Next
End While
'gputils = New GPUtilities
pProgressTracker = New TrackCancel
'Get the environment manager
pGPCOMHelper = New GpDispatch
pGPEnvMgr = pGPCOMHelper.EnvironmentManager
'Set output coordinate system
pGPEnv_CoordSys = pGPEnvMgr.FindEnvironment("outputCoordinateSystem")
pGPEnv_CoordSys.Value = pGPEnv_CoordSys.DataType.CreateValue(ArcMap_INSTALL_DIR & "Coordinate Systems\Projected Coordinate Systems\National Grids\Your National Grid.prj")
'Set extents
pGPEnv_Extent = pGPEnvMgr.FindEnvironment("extent")
pGPEnv_Extent.Value = pGPEnv_Extent.DataType.CreateValue("sameAsInput")
'Create a toolbox workspace factory
pToolboxWorkspaceFactory = New ToolboxWorkspaceFactory
'Open toolbox workspace
pToolboxWorkspace = pToolboxWorkspaceFactory.OpenFromFile(ArcMap_INSTALL_DIR & "ArcToolbox\Toolboxes", 0)
'Open toolbox by name
pGPToolbox = pToolboxWorkspace.OpenToolbox("Data Interoperability Tools.tbx")
'If DI Toolbox is not found, means extensions were not installed
If pGPToolbox Is Nothing Then
MsgBox("Data Interoperability Toolbox not found!" & vbCrLf & "Please contact helpdesk.", MsgBoxStyle.Critical)
Throw New CustomException
End If
'Open tool by name
pGPTool = pGPToolbox.OpenTool("QuickExport") 'You need to use QuickImport
'Get parameters required for the tool
pParamArray = pGPTool.ParameterInfo
If Not (Inv_Layer_Names Is Nothing Or String.IsNullOrEmpty(Inv_Layer_Names) Or Inv_Layer_Names = "") Then
'Remove trailing ";"
Inv_Layer_Names = Inv_Layer_Names.Remove(Inv_Layer_Names.LastIndexOf(";"))
'Set input parameters
pParameter = pParamArray.Element(0)
pParameterEdit = pParameter
pDataType = pParameter.DataType
pParameterEdit.Value = pDataType.CreateValue(Inv_Layer_Names)
'Set output parameters
pParameter = pParamArray.Element(1)
pParameterEdit = pParameter
pDataType = pParameter.DataType
pParameterEdit.Value = pDataType.CreateValue("GMLSF, " & FILE_STORAGE_PATH.Substring(0, FILE_STORAGE_PATH.LastIndexOf(".")) & ".gml")
'Validate input parameters
pGPMessages = pGPTool.Validate(pParamArray, True, Nothing)
'Execute tool for at least inventory layers
pGPTool.Execute(pParamArray, pProgressTracker, pGPEnvMgr, pGPMessages)
End If
Catch ex As Exception
Throw New CustomException(ex.Message, ex)
Finally
'Release resources
pGPMessages = Nothing
pParameterEdit = Nothing
pDataType = Nothing
pParameterEdit = Nothing
pParameter = Nothing
pParamArray = Nothing
pGPTool = Nothing
pGPToolbox = Nothing
pToolboxWorkspace = Nothing
pToolboxWorkspaceFactory = Nothing
pGPEnv_Extent = Nothing
pGPEnv_CoordSys = Nothing
pGPEnvMgr = Nothing
pGPCOMHelper = Nothing
pProgressTracker = Nothing
End Try
End Sub