Shapefile文件数据库操作--ArcEngine +C#

很久不搞又有点忘记了,干脆记下来,免得到处找

一、 通过FeatureLayer 找到数据库

IfeatureClas featClass = featureLayer.FeatureClass;

IDataSet dataset = featClass as IDataset;

IWorkspace ws = dataset.Workspace;

 

二、 通过数据库文件读取数据

IWorkspaceFactory wsf = new ShapefileWorkspaceFactory();

IWorkspace  pWorkspace = wsf.Open(filePath, 0) ;//filePath为shapefile所在的文件夹

IFeatureWorkspace pFeatureWorkspace = pWorkspace ;

IFeatureClass pFeatureClass  = pFeatureWorkspace.OpenFeatureClass("parcels");//parcels为shapefile文件名pacels.shp




 

 

你可能感兴趣的:(ArcEngine)