矢量转栅格
转自:
http://www.cnblogs.com/mynama/default.html?page=1
http://www.cnblogs.com/mynama/default.html?page=1
IMap pMap = axMapControl1.Map;
IFeatureLayer pFeatLyr = (IFeatureLayer)axMapControl1.get_Layer(0);
IFeatureClass pFeatClass = pFeatLyr.FeatureClass;
IFeatureClassDescriptor pFClsDp = new FeatureClassDescriptorClass();
pFClsDp.Create(pFeatClass, null, "CODE");
IWorkspaceFactory pWsf = new RasterWorkspaceFactoryClass();
IWorkspace pWs = pWsf.OpenFromFile(@"E:\data\result", 0);
IConversionOp pConOp = new RasterConversionOpClass();
IRasterAnalysisEnvironment pRasterEn = pConOp as IRasterAnalysisEnvironment;
object oo = 200;
pRasterEn.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref oo);
IRasterDataset pRDataset = pConOp.ToRasterDataset(pFClsDp as IGeoDataset, "GRID", pWs, "raster");
IRasterLayer pRlyr = new RasterLayerClass();
pRlyr.CreateFromDataset(pRDataset);
pMap.AddLayer(pRlyr as ILayer);
IFeatureLayer pFeatLyr = (IFeatureLayer)axMapControl1.get_Layer(0);
IFeatureClass pFeatClass = pFeatLyr.FeatureClass;
IFeatureClassDescriptor pFClsDp = new FeatureClassDescriptorClass();
pFClsDp.Create(pFeatClass, null, "CODE");
IWorkspaceFactory pWsf = new RasterWorkspaceFactoryClass();
IWorkspace pWs = pWsf.OpenFromFile(@"E:\data\result", 0);
IConversionOp pConOp = new RasterConversionOpClass();
IRasterAnalysisEnvironment pRasterEn = pConOp as IRasterAnalysisEnvironment;
object oo = 200;
pRasterEn.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref oo);
IRasterDataset pRDataset = pConOp.ToRasterDataset(pFClsDp as IGeoDataset, "GRID", pWs, "raster");
IRasterLayer pRlyr = new RasterLayerClass();
pRlyr.CreateFromDataset(pRDataset);
pMap.AddLayer(pRlyr as ILayer);
posted on 2008-07-15 11:08 duckweeds 阅读(1442) 评论(0) 编辑 收藏 举报