既存シェープファイル フィーチャクラスの取得

 2016/9/1 (木)    

Public Function fncOpenShapefile(sPath As String, sFile As String) As IFeatureClass
'    Dim sPath As String
'    sPath = "D:\Data"
'
'    Dim sFile As String
'    sFile = "Shapefile.shp"
     
    Dim pWorkspaceFactory As IWorkspaceFactory
    Set pWorkspaceFactory = New ShapefileWorkspaceFactory
     
    Dim pFeatureWorkspace As IFeatureWorkspace
    Set pFeatureWorkspace = pWorkspaceFactory.OpenFromFile(sPath, Application.hWnd)
     
    Dim pFeatureClass As IFeatureClass
    Set pFeatureClass = pFeatureWorkspace.OpenFeatureClass(sFile)
     
    Set fncOpenShapefile = pFeatureClass
     
End Function

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.