1. 程式人生 > >ArcGIS Engine線密度分析

ArcGIS Engine線密度分析

與核密度分析相同,只是指定要素為線要素。

全部程式碼:

        private ILayer lineDesityOp(IFeatureClass pFeatureClass,string pFullPath,double cellsize,double radius)
        {
            //定義點密度分析類
            IDensityOp pDensityOp = new RasterDensityOpClass();  //定義密度分析函式

            //設定柵格分析環境
            IRasterAnalysisEnvironment pEnv = pDensityOp as IRasterAnalysisEnvironment;
            object obj_cellsize = (object)cellsize;
            pEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref obj_cellsize);

            //定義資料描述
            IFeatureClassDescriptor pFCD = new FeatureClassDescriptorClass();
            pFCD.Create(pFeatureClass, null, pFullPath);

            //基本引數
            object obj_radius = (object)cellsize;
            object Missing = Type.Missing;

            //進行線密度轉化
            IRaster PRaster=pDensityOp.LineDensity(pFCD as IGeoDataset, obj_radius, Missing) as IRaster;

            IRasterLayer pRasterLayer = new RasterLayerClass();
            pRasterLayer.CreateFromRaster(PRaster);

            ILayer pLayer = pRasterLayer as ILayer;

            return pLayer;
        }