zoukankan      html  css  js  c++  java
  • ae中栅格数据转为矢量数据

    ILayer pLayer = pAxMapControl.get_Layer(this.cmbLayer.SelectedIndex);
                IRasterLayer pRasterLayer = pLayer as IRasterLayer;

                IWorkspaceFactory2 pWorkspaceFactory2 = new RasterWorkspaceFactoryClass();
                IRasterWorkspace pRasterWorkspace;

                int Index = pRasterLayer.FilePath.LastIndexOf("\\");
                string filePath = pRasterLayer.FilePath.Substring(0, Index);
                string fileName = pRasterLayer.FilePath.Substring(Index + 1);

                pRasterWorkspace = (IRasterWorkspace)pWorkspaceFactory2.OpenFromFile(filePath, 0);
                IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset(fileName);


                IGeoDataset pRasterGeoDataset = pRasterDataset as IGeoDataset;
                IWorkspaceFactory2 pWorkspaceFactoryShp = new ShapefileWorkspaceFactoryClass();
                //............................................................................
                IWorkspace pWorkspace = pWorkspaceFactoryShp.OpenFromFile(this.tbFolderPath.Text, 0);
                IConversionOp pConversionOp = new RasterConversionOpClass();
                ISpatialReference pSpatialReference = pRasterGeoDataset.SpatialReference;

                IGeoDataset pGeoDataset;
                //....................................................................
                pGeoDataset = pConversionOp.RasterDataToPolygonFeatureData(pRasterGeoDataset, pWorkspace, this.tbName.Text, true);

                IDataset pDataset1 = pGeoDataset as IDataset;
                IFeatureClass pFeatureClass = pDataset1 as IFeatureClass;

                IFeatureLayer pFeatureLayer = new FeatureLayerClass();
                pFeatureLayer.FeatureClass = pFeatureClass;

                pAxMapControl.ClearLayers();
                pAxMapControl.AddLayer(pFeatureLayer);
                pAxMapControl.Refresh();
  • 相关阅读:
    git基本操作及设置
    5-13 多页面打包配置
    笔记待整理
    单例模式在多线程下的多种实现模式
    面试题小练习1106
    求两个字符串的最大共有子串
    单例模式
    静态初始化一个二维数组并将二维数组排序并输出
    java中数组的基本知识
    关于break语句如何结束多重循环的嵌套
  • 原文地址:https://www.cnblogs.com/weihongli/p/2132791.html
Copyright © 2011-2022 走看看