Example #1
0
        protected void addCSUSatellite()
        {
            IRasterLayer rl = new RasterLayer();

            rl.CreateFromFilePath(@"D:\Assignment\Senior1\GISdev\data\csu.jpg");
            mapControl.AddLayer(rl, mapControl.LayerCount);
        }
Example #2
0
        private void loadRasterList()
        {
            bool itWorked = false;

            foreach (KeyValuePair <String, Boolean> raster in rasterList)
            {
                if (raster.Value == true)
                {
                    if (!itWorked)
                    {
                        saveFileTypeList(getExtension());
                    }
                    itWorked = true;

                    string filePath = txbRasterWorkspace.Text + "\\" + addPrefixAndSuffixToFileName(raster.Key) + getExtension();
                    try
                    {
                        IRasterLayer rasterLayer = new RasterLayer();
                        rasterLayer.CreateFromFilePath(filePath);
                        _mxdocument.AddLayer(rasterLayer);
                    }
                    catch (Exception ex)
                    {
                        ex.ToString();
                        // Just So ArcMap doesn't crash ;)
                    }
                }
            }
            if (itWorked)
            {
                _mxdocument.ActivatedView.Refresh();
            }

            rasterList.Clear();
        }
        // Skapar aspektlager.
        public IRasterLayer createAspect(System.String inRaster, System.String outPath)
        {
            if (aspect != null)
            {
                return(aspect);
            }

            IRasterLayer rLayer = new RasterLayer();

            if (inRaster == "" || outPath == "")
            {
                MessageBox.Show("Check your rasters");
            }
            else
            {
                Geoprocessor gp = new Geoprocessor();
                gp.OverwriteOutput = true;
                //gp.AddOutputsToMap = false;

                Aspect aspectTool = new Aspect();
                aspectTool.in_raster  = inRaster;
                aspectTool.out_raster = outPath;

                IGeoProcessorResult geoProcessorResult = (IGeoProcessorResult)gp.Execute(aspectTool, null);
                rLayer.CreateFromFilePath(outPath);
                aspect = rLayer;
            }
            return(rLayer);
        }
Example #4
0
        public void Add_Raster()
        {
            IMxDocument pMxDoc;

            pMxDoc = (IMxDocument)ArcMap.Application.Document;

            IMap pMap;

            pMap = pMxDoc.FocusMap;

            IRasterLayer pRLayer;

            pRLayer = new RasterLayer();

            // ** Can also go through a process similar to that of a feature layer,
            // ** but this is a nice shortcut!
            pRLayer.CreateFromFilePath("C:/wcgis/geog484/Lesson1/data/cobhamclip.tif");
            pRLayer.Name = "Cobham DRG";
            pMap.AddLayer(pRLayer);

            pMxDoc.UpdateContents();

            IActiveView pActiveView;

            pActiveView = (IActiveView)pMap;
            pActiveView.Refresh();
        }
        private void LoadFileList()
        {
            bool       itWorked    = false;
            GroupLayer rasterGroup = null;

            if (_fileList.Count > 0)
            {
                rasterGroup      = new GroupLayer();
                rasterGroup.Name = "New Files";
            }

            foreach (KeyValuePair <String, Boolean> file in _fileList)
            {
                if (file.Value == true)
                {
                    if (!itWorked)
                    {
                        //SaveFileTypeList(GetExtension());
                        itWorked = true;
                    }

                    string filePath = txb_FileWorkspace.Text + "\\" + Utilities.Utilities_General.AddPrefixAndSuffixToFileName(file.Key, txb_Prefix.Text, txb_Suffix.Text) + GetExtension();
                    try
                    {
                        IRasterLayer rasterLayer = new RasterLayer();
                        rasterLayer.CreateFromFilePath(filePath);
                        ILegendGroup group = ((ILegendInfo)rasterLayer).get_LegendGroup(0);
                        group.Visible = false;
                        rasterGroup.Add(rasterLayer);
                    }
                    catch (Exception ex)
                    {
                        ex.ToString();
                        // Just So ArcMap doesn't crash ;)
                    }
                }
            }
            if (itWorked)
            {
                if (rasterGroup != null)
                {
                    _mxdocument.AddLayer(rasterGroup);
                }
                _mxdocument.ActivatedView.Refresh();
            }

            _fileList.Clear();
        }
Example #6
0
        public void AddDrapeLayerToGlobeElevationSurface(IGlobeDisplay globeDisplay, ILayer layer, System.String elevationRasterFilePath)
        {
            ChangeProp(layer);

            IGlobeDisplayLayers globeDisplayLayers = (IGlobeDisplayLayers)globeDisplay; // Explicit cast

            IFeatureLayer pFeatureLayer = (IFeatureLayer)layer;

            pFeatureLayer.Cached = true;

            // Create elevation raster layer
            IRasterLayer elevationRasterLayer = new RasterLayer();

            elevationRasterLayer.CreateFromFilePath(elevationRasterFilePath);

            // Create and add the GlobeLayerProperties extension with the Type set to ElevationData
            IGlobeLayerProperties globeLayerProperties = new GlobeLayerProperties();

            globeLayerProperties.Type = esriGlobeDataType.esriGlobeDataElevation;
            ILayerExtensions layerExtension = (ILayerExtensions)elevationRasterLayer; // Explicit cast

            layerExtension.AddExtension(globeLayerProperties);

            // Set the base option for layer to be esriGlobeLayerBaseLayer and its base layer to be ElevationLayer
            IGlobeLayerProperties  drapeLayerGlobeLayerProperties  = globeDisplayLayers.FindGlobeProperties(layer);
            IGlobeHeightProperties drapeLayerGlobeHeightProperties = drapeLayerGlobeLayerProperties.HeightProperties;

            //
            drapeLayerGlobeHeightProperties.BaseLayer  = elevationRasterLayer;
            drapeLayerGlobeHeightProperties.BaseOption = esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer;
            drapeLayerGlobeHeightProperties.ElevationExpressionString = "[Elevation] * 1000";
            // drapeLayerGlobeHeightProperties.ExtrusionType =  ESRI.ArcGIS.Analyst3D.esriExtrusionType.esriExtrusionBase;
            //drapeLayerGlobeHeightProperties.ExtrusionExpressionString = "Elevation * 1000";
            // Apply the height properties of the layer
            globeDisplayLayers.ApplyHeightProperties(layer);
            drapeLayerGlobeHeightProperties.Apply(m_Globe, layer);
            // globeDisplay.RefreshViewers();

            globeDisplayLayers.RefreshLayer(layer);
            IActiveView pacv = (IActiveView)m_Globe;

            pacv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, null);
        }
Example #7
0
        protected override void OnMouseUp(MouseEventArgs arg)
        {
            base.OnMouseUp(arg);

            IPoint pPoint;

            pPoint = pMxDoc.CurrentLocation;

            string strOrthoidField;

            strOrthoidField = "ORTHOID";

            string strOrthoidVal;

            strOrthoidVal = GetFeatureVal(pPoint, pOrthoIdxLayer, strOrthoidField);

            //** Reports ortho id # clicked. Remove this line if you do not want this functionality.
            MessageBox.Show("Adding the ortho id #" + strOrthoidVal);

            IRasterLayer pRLayer;

            pRLayer = new RasterLayer();

            //* Loads and concatenates file
            pRLayer.CreateFromFilePath("C:/Users/jcarpenter/Documents/PennState/Geog489/Lesson3/Data/orthos/" + strOrthoidVal + ".tif");
            pRLayer.Name = "Photo - Tile " + strOrthoidVal;
            pMap.AddLayer(pRLayer);

            //* Generates index from layer count
            int toIndex;

            toIndex = pMap.LayerCount;

            //* Moves the layer to the bottom
            pMap.MoveLayer(pRLayer, toIndex);

            IActiveView pActiveView;

            pActiveView = (IActiveView)pMap;
            pActiveView.Refresh();
        }
        // Skapar backlinklager.
        public void createBackLink(System.String costRaster, System.String sourceRaster, System.String outPath)
        {
            if (costRaster == "" || sourceRaster == "" || outPath == "")
            {
                MessageBox.Show("Check your rasters");
            }
            else
            {
                Geoprocessor gp = new Geoprocessor();
                gp.OverwriteOutput = true;
                //gp.AddOutputsToMap = false;

                CostBackLink backLinkTool = new CostBackLink();
                backLinkTool.in_cost_raster      = cost;
                backLinkTool.in_source_data      = source;
                backLinkTool.out_backlink_raster = outPath;

                IGeoProcessorResult geoProcessorResult = (IGeoProcessorResult)gp.Execute(backLinkTool, null);
                backLink = new RasterLayer();
                backLink.CreateFromFilePath(outPath);
            }
        }
        // Öppnar rasterlager.
        public void AddRasterUsingOpenFileDialog(IActiveView activeView)
        {
            if (activeView == null)
            {
                return;
            }

            System.Windows.Forms.OpenFileDialog openFileDialog = new
                                                                 System.Windows.Forms.OpenFileDialog();
            openFileDialog.InitialDirectory = @"H:\VT2019\GIS_App\Projekt\Program\Data\InData";
            openFileDialog.Filter           = "Rasterfiles (*.tif)|*.tif";
            openFileDialog.FilterIndex      = 2;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.Multiselect      = false;

            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                IRasterLayer rasterLayer = new RasterLayer();
                rasterLayer.CreateFromFilePath(openFileDialog.FileName);
                mxDoc.AddLayer(rasterLayer);
            }
        }
Example #10
0
        private void 添加图层ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog openFile = new OpenFileDialog();
                string         fileName;

                openFile.Title  = "添加栅格数据";
                openFile.Filter = "TIFF图像(*.tif)|*.tif|所有文件(*.*)|*.*";
                openFile.ShowDialog();
                fileName = openFile.FileName;

                // mainMap.AddLayerFromFile(fileName, 0);
                IRasterLayer rasterLayer;
                rasterLayer = new RasterLayer();
                rasterLayer.CreateFromFilePath(fileName);
                mainMap.AddLayer(rasterLayer);
            }
            catch
            {
                MessageBox.Show("添加栅格数据错误!");
            }
        }
Example #11
0
        protected override void OnMouseUp(MouseEventArgs arg)
        {
            try
            {
                IPoint pPoint; //Point object for clicked location
                pPoint = m_pMxDoc.CurrentLocation;

                //Create string variable to hold the field name in the ortho index
                string orthoField = "ORTHOID";

                //Call method to get value of clicked index
                string strFieldValue;
                strFieldValue = getFeatureVal.featureUtility(pPoint, m_pOrthoIndexLayer, orthoField);

                //Create a Raster Layer object
                IRasterLayer pRLayer;
                pRLayer = new RasterLayer();

                //Set the path to the selected image
                pRLayer.CreateFromFilePath("C:/Users/micha/Documents/GEOG 489/Lesson_3/Data/orthos/" + strFieldValue + ".tif");
                pRLayer.Name = "Tile " + strFieldValue; //Update layer name

                //Add the ortho image to the map
                m_pMap.AddLayer(pRLayer);

                //Move the image to the bottom in the TOC
                m_pMap.MoveLayer(pRLayer, m_pMap.LayerCount - 1);

                //Update the map contents
                m_pMxDoc.UpdateContents();
            }

            catch (System.Exception ex)
            {
                MessageBox.Show("Error: This index does not have an orthophoto");
            }
        }
Example #12
0
        public void AddLayer(string layerpath)
        {
            IRasterLayer rasterLayer;

            rasterLayer = new RasterLayer();
            rasterLayer.CreateFromFilePath(layerpath);
            if (frm.axTOCControl1.InvokeRequired)//如果调用控件的线程和创建控件的线程不是同一个则为true
            {
                while (!frm.axTOCControl1.IsHandleCreated)
                {
                    //解决窗体关闭时出现“访问已释放句柄”的异常
                    if (frm.axTOCControl1.Disposing || frm.axTOCControl1.IsDisposed)
                    {
                        return;
                    }
                }
                AddLayerdelegate d = new AddLayerdelegate(AddLayer);
                frm.axTOCControl1.Invoke(d, new object[] { layerpath });
            }
            else
            {
                frm.mainMap.AddLayer(rasterLayer);
            }
        }
Example #13
0
        // Skapar minstakostnadslager.
        public IRasterLayer createLeastCost(System.String destinationRaster, System.String outPath)
        {
            if (destinationRaster == "" || outPath == "")
            {
                MessageBox.Show("Check your rasters");
            }
            else
            {
                Geoprocessor gp = new Geoprocessor();
                gp.OverwriteOutput = true;
                //gp.AddOutputsToMap = false;

                CostPath costPathTool = new CostPath();
                costPathTool.in_cost_backlink_raster = backLink;
                costPathTool.in_cost_distance_raster = costDist;
                costPathTool.in_destination_data     = dest;
                costPathTool.out_raster = outPath;

                IGeoProcessorResult geoProcessorResult = (IGeoProcessorResult)gp.Execute(costPathTool, null);
                leastCost = new RasterLayer();
                leastCost.CreateFromFilePath(outPath);
            }
            return(leastCost);
        }
        protected override void OnClick()
        {
            string straboPath = Environment.GetEnvironmentVariable(ArcStrabo2Extension.EnvironmentVariableSTRABO_HOME, EnvironmentVariableTarget.User);
            string tessPath   = Environment.GetEnvironmentVariable(ArcStrabo2Extension.EnvironmentVariableTESS_DATA, EnvironmentVariableTarget.User);


            if (ArcStrabo2Extension.PathSet == false)
            {
                if (String.IsNullOrEmpty(straboPath) == true)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoStraboHome);
                    return;
                }
                if (String.IsNullOrEmpty(tessPath) == true)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoTess_Data);
                    return;
                }

                bool Initialize_straboPath_Correct = ArcStrabo2Extension.initialize_straboPath_directories(straboPath);

                if (Initialize_straboPath_Correct == false)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoStraboHomeWritePermission);
                    return;
                }

                ArcStrabo2Extension.PathSet = true;
            }
            //
            //  TODO: Sample code showing how to access button host
            //
            ArcMap.Application.CurrentTool = null;
            ComboBoxLayerSelector layerNameCombo = ComboBoxLayerSelector.GetLayerNameComboBox();

            RasterLayer rasterlayer = new RasterLayer();

            rasterlayer = ((RasterLayer)layerNameCombo.GetSelectedLayer());
            //raster.Raster
            //RasterLayer raster2 = new RasterLayer();
            //raster2.CreateFromRaster(raster.Raster);
            //IMap map = ArcMap.Document.FocusMap;
            //map.AddLayer((ILayer)raster2);
            //MessageBox.Show(layerNameCombo.selected_layer_name + " " + raster2.RowCount + " " + raster2.ColumnCount + " " + raster2.BandCount);
            ColorSegmentationWorker cs = new ColorSegmentationWorker();

            try
            {
                IRaster2 iraster2   = rasterlayer.Raster as IRaster2;
                string[] bitmap_fns = cs.Apply(System.IO.Path.GetDirectoryName(iraster2.RasterDataset.CompleteName) + "\\", ArcStrabo2Extension.Text_Result_Path + "\\", System.IO.Path.GetFileName(iraster2.RasterDataset.CompleteName));
                IMap     map        = ArcMap.Document.FocusMap;
                foreach (string path in bitmap_fns)
                {
                    //RasterDataset rds = new RasterDataset();
                    //rds.OpenFromFile(path);
                    RasterLayer rasterlayer2 = new RasterLayer();
                    rasterlayer2.CreateFromFilePath(path);
                    map.AddLayer(rasterlayer2);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        protected override void OnClick()
        {
            string straboPath = Environment.GetEnvironmentVariable(ArcStrabo2Extension.EnvironmentVariableSTRABO_HOME, EnvironmentVariableTarget.User);
            string tessPath = Environment.GetEnvironmentVariable(ArcStrabo2Extension.EnvironmentVariableTESS_DATA, EnvironmentVariableTarget.User);

            if (ArcStrabo2Extension.PathSet == false)
            {

                if (String.IsNullOrEmpty(straboPath) == true)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoStraboHome);
                    return;
                }
                if (String.IsNullOrEmpty(tessPath) == true)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoTess_Data);
                    return;
                }

                bool Initialize_straboPath_Correct = ArcStrabo2Extension.initialize_straboPath_directories(straboPath);

                if (Initialize_straboPath_Correct == false)
                {
                    MessageBox.Show(ArcStrabo2Extension.ErrorMsgNoStraboHomeWritePermission);
                    return;
                }

                ArcStrabo2Extension.PathSet = true;
            }
            //
            //  TODO: Sample code showing how to access button host
            //
            ArcMap.Application.CurrentTool = null;
            ComboBoxLayerSelector layerNameCombo = ComboBoxLayerSelector.GetLayerNameComboBox();

            RasterLayer rasterlayer = new RasterLayer();
            rasterlayer = ((RasterLayer)layerNameCombo.GetSelectedLayer());
            //raster.Raster
            //RasterLayer raster2 = new RasterLayer();
            //raster2.CreateFromRaster(raster.Raster);
            //IMap map = ArcMap.Document.FocusMap;
            //map.AddLayer((ILayer)raster2);
            //MessageBox.Show(layerNameCombo.selected_layer_name + " " + raster2.RowCount + " " + raster2.ColumnCount + " " + raster2.BandCount);
            ColorSegmentationWorker cs = new ColorSegmentationWorker();
            try
            {
                IRaster2 iraster2 = rasterlayer.Raster as IRaster2;
                string[] bitmap_fns = cs.Apply(System.IO.Path.GetDirectoryName(iraster2.RasterDataset.CompleteName) + "\\", ArcStrabo2Extension.Text_Result_Path + "\\", System.IO.Path.GetFileName(iraster2.RasterDataset.CompleteName));
                IMap map = ArcMap.Document.FocusMap;
                foreach (string path in bitmap_fns)
                {
                    //RasterDataset rds = new RasterDataset();
                    //rds.OpenFromFile(path);
                    RasterLayer rasterlayer2 = new RasterLayer();
                    rasterlayer2.CreateFromFilePath(path);
                    map.AddLayer(rasterlayer2);
                }
            }
            catch (Exception e)
            {

                Console.WriteLine(e.ToString());
            }
        }
Example #16
0
        private void BtnOK_Click(object sender, EventArgs e)
        {
            List <string> indexlist = new List <string>();

            indexlist.Add(layerpath.Text.Trim());
            indexlist.Add(resulttext.Text.Trim());
            for (int i = 1; i <= Convert.ToInt32(CmbLineCount.Text) - 1; i++)
            {
                String str;
                str = DataGridFilterData[i - 1, 0].ToString();
                string fvalue, tvalue;
                int    p;
                p      = str.LastIndexOf("~");
                fvalue = str.Substring(0, p);
                indexlist.Add(fvalue);
                //tvalue = Convert.ToSingle(str.Substring(p + 1, str.Length - p - 1));
                //pSRemap.MapRange(fvalue, tvalue, i);
            }
            string str2 = DataGridFilterData[Convert.ToInt32(CmbLineCount.Text) - 2, 0].ToString();
            int    p2;

            p2 = str2.LastIndexOf("~");
            indexlist.Add(str2.Substring(p2 + 1, str2.Length - p2 - 1));
            for (int i = 1; i <= Convert.ToInt32(CmbLineCount.Text) - 1; i++)
            {
                String str;
                str = DataGridFilterData[i - 1, 1].ToString();
                indexlist.Add(str);
            }
            string        sArgName = "Recalssify2.py";
            string        args     = "";
            List <string> teps     = indexlist;

            Control.CheckForIllegalCrossThreadCalls = false;
            Process pro  = new Process();
            string  path = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "python\\" + sArgName;// 获得python文件的绝对路径

            pro.StartInfo.FileName = @"C:\Python27\python.exe";
            string sArguments = path;

            if (teps.Count > 0)
            {
                foreach (string sigstr in teps)
                {
                    //sArguments += " " + "u"+"'"+sigstr+"'";//传递参数
                    sArguments += " " + (sigstr);//传递参数
                }
            }
            if (args.Length > 0)
            {
                sArguments += " " + args;
            }
            pro.StartInfo.Arguments              = sArguments;
            pro.StartInfo.UseShellExecute        = false;
            pro.StartInfo.RedirectStandardOutput = true;
            pro.StartInfo.RedirectStandardInput  = true;
            pro.StartInfo.RedirectStandardError  = true;
            pro.StartInfo.CreateNoWindow         = true; //FALSE为显示cmd窗口

            pro.StartInfo.StandardOutputEncoding = Encoding.UTF8;
            pro.Start();
            pro.BeginOutputReadLine();
            //p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived); //监听获得cmd中的输出信息
            pro.EnableRaisingEvents = true;//程序退出引发事件
            //p.Exited += new EventHandler(robotOpenProcess_Exited);
            //Console.ReadLine();
            pro.WaitForExit();
            IRasterLayer rasterLayer;

            rasterLayer = new RasterLayer();
            rasterLayer.CreateFromFilePath(resulttext.Text.Trim());
            mainfrm.mainMap.AddLayer(rasterLayer);
            // mainfrm.mainMap.AddLayer(resulttext.Text.Trim());
            //Subfrm.Close();
            //RunPythonScript rps = new RunPythonScript(mainfrm, "");
            ////QAClass inputqa = new QAClass();
            //rps.pythonscript = "firstndvimean.py";
            //rps.temp = "";
            //rps.index = indexlist;
            //rps.RunPythonScriptFunction();
        }
        /// <summary>
        /// 道路风险计算
        /// </summary>
        /// <param name="workPath">存储路径</param>
        /// <param name="roadEvalPath">道路评价结果 </param>
        /// <param name="roadRainsShpPath">加了雨量字段的道路缓冲区</param>
        /// <returns></returns>
        public bool RoadRaskCaulte(string roadEvalName, string roadRainsName, string saveWorkspace)
        {
            //读取 道路评价结果栅格数据的信息
            RasterHelper rh = new RasterHelper();
            //IRasterWorkspace rasterWorkspace =  new RasterLayer();
            IWorkspaceFactory rWorkspaceFactory = new RasterWorkspaceFactory();
            IWorkspace        SWorkspace        = rWorkspaceFactory.OpenFromFile(saveWorkspace, 0);
            IRasterWorkspace  rasterWorkspace   = SWorkspace as IRasterWorkspace;

            IRasterDataset rasterDt = rasterWorkspace.OpenRasterDataset(roadEvalName);

            //  var t = rh.GetRasterProps(rasterDt);
            IRasterLayer rasterLayer = new RasterLayer();

            rasterLayer.CreateFromFilePath(saveWorkspace + "\\" + roadEvalName);
            IRaster pRaster = rasterLayer.Raster;

            IRasterProps rasterProps = (IRasterProps)pRaster;;//存储了栅格信息

            //初始化GP工具
            Geoprocessor gp = new Geoprocessor();

            gp.OverwriteOutput = true;
            //string path = @"D:\GISTest";
            //gp.SetEnvironmentValue("workspace", path);
            //道路缓冲区 根据雨量转栅格
            FeatureToRaster featureToRaster = new FeatureToRaster();

            featureToRaster.cell_size   = rasterProps.MeanCellSize().X;//这里可以提前规定一个值,而不是每次去读取
            featureToRaster.in_features = OpenFeatureClass(saveWorkspace + "\\" + roadRainsName);
            featureToRaster.out_raster  = saveWorkspace + "\\roadGrid";
            featureToRaster.field       = "RAINS";//这个字段需要矢量图层中加上
            try
            {
                gp.Execute(featureToRaster, null);
            }
            catch (Exception ex)
            {
                Console.WriteLine("矢量转栅格失败!");
                return(false);
            }

            //栅格计算器 计算风险级数
            IMapAlgebraOp  mapAlgebra     = new RasterMapAlgebraOpClass();
            IRasterDataset roadEvalRaster = OpenRasterDataSet(rasterWorkspace, roadEvalName);
            IRasterDataset roadGridRaster = OpenRasterDataSet(rasterWorkspace, saveWorkspace + @"\roadGrid");
            IGeoDataset    geo1           = roadEvalRaster as IGeoDataset;
            IGeoDataset    geo2           = roadGridRaster as IGeoDataset;

            mapAlgebra.BindRaster(geo1, "EvalRaster");
            mapAlgebra.BindRaster(geo2, "RoadRains");
            IGeoDataset raskDataset = mapAlgebra.Execute("[EvalRaster] * [RoadRains] / 25");//然后存储  表达式必须间隔开
            ISaveAs     saveAs      = raskDataset as ISaveAs;

            saveAs.SaveAs("roadPre", SWorkspace, "");
            //加入图层
            IRasterLayer rasterLayer2 = new RasterLayer();

            rasterLayer2.CreateFromFilePath(saveWorkspace + "\\" + "roadPre");

            MainFrom.m_mapControl.AddLayer(rasterLayer2, 0);
            //MainFrom.m_mapControl.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
            MainFrom.m_pTocControl.Update();
            //将生成的风险栅格重分类
            //<0.2	一级:可能性小
            //0.2-0.4	二级:可
            //能性较小
            //0.4-0.6	三级:可能性较大
            //0.6-0.8	四级:可能性大
            //>0.8	五级:可能性很大
            // 输入:raskDataset

            // 输出:geoDataset_result
            IReclassOp pReclassOp   =  new RasterReclassOpClass();
            INumberRemap pNumRemap  =  new NumberRemapClass();
            IDictionary <int, RoadRange> roadRanges = this.roadRiskConfig.GetRoadRiskLevelFromConfig();

            foreach (var v in roadRanges)
            {
                pNumRemap.MapRange(v.Value.MinValue, v.Value.MaxValue, v.Key);
            }

            /*
             * pNumRemap.MapRange(0, 0.2, 1);
             * pNumRemap.MapRange(0.2, 0.4, 2);
             * pNumRemap.MapRange(0.4, 0.6, 3);
             * pNumRemap.MapRange(0.6, 0.8, 4);
             * pNumRemap.MapRange(0.8,1000,5);
             */
            //pNumRemap.MapRangeToNoData(-1000,0);
            //pNumRemap.MapRangeToNoData(1000, 20000);
            IRemap pRemap = pNumRemap as IRemap;

            // 重分类
            // geoDataset为上一步得到的栅格
            //     IGeoDataset geoDataset_result = pReclassOp.ReclassByRemap(raskDataset, pRemap, true);//还没有测试成功


            // RasterCalculator rasterCalculator = new RasterCalculator("[EvalRaster]*[RoadRains]/25", saveWorkspace + @"\RainEval.tif");
            try
            {
                // gp.Execute(rasterCalculator, null);
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                for (int i = 0; i < gp.MessageCount; i++)
                {
                    Debug.Print(gp.GetMessage(i));
                }
                Console.WriteLine("栅格计算失败!");
                return(false);
            }
            return(true);
        }