コード例 #1
0
        public static IRaster Fill(IRaster surface, string outputPath)
        {
            var geoprocessor = GeoprocessingUtility.GetGeoprocessor(true, false, true, surface);

            var fillTool = new ESRI.ArcGIS.SpatialAnalystTools.Fill();

            fillTool.in_surface_raster  = GeoprocessingUtility.GetGPRasterObject(surface);
            fillTool.out_surface_raster = outputPath;

            string  resultPath   = GeoprocessingUtility.RunGpTool(geoprocessor, fillTool) as string;
            IRaster outputRaster = GeoprocessingUtility.GetRasterFromPath(resultPath);

            GeoprocessingUtility.ResetGeoprocessor();

            return(outputRaster);
        }
コード例 #2
0
        public static IRaster FlowDirection(IRaster surface, string outputPath, bool forceFlowToEdge = false)
        {
            var geoprocessor = GeoprocessingUtility.GetGeoprocessor(true, false, true, surface);

            var flowDirTool = new ESRI.ArcGIS.SpatialAnalystTools.FlowDirection();

            flowDirTool.in_surface_raster         = GeoprocessingUtility.GetGPRasterObject(surface);
            flowDirTool.force_flow                = forceFlowToEdge ? "FORCE" : "NORMAL";
            flowDirTool.out_flow_direction_raster = outputPath;

            string  resultPath   = GeoprocessingUtility.RunGpTool(geoprocessor, flowDirTool) as string;
            IRaster outputRaster = GeoprocessingUtility.GetRasterFromPath(resultPath);

            GeoprocessingUtility.ResetGeoprocessor();

            return(outputRaster);
        }
コード例 #3
0
        public static IRaster SetNull(IRaster condition, IRaster falseRaster, string outputPath)
        {
            var geoprocessor = GeoprocessingUtility.GetGeoprocessor();

            var setNullTool = new ESRI.ArcGIS.SpatialAnalystTools.SetNull();

            setNullTool.in_conditional_raster       = GeoprocessingUtility.GetGPRasterObject(condition);
            setNullTool.in_false_raster_or_constant = GeoprocessingUtility.GetGPRasterObject(falseRaster);
            setNullTool.out_raster = outputPath;

            string  resultPath   = GeoprocessingUtility.RunGpTool(geoprocessor, setNullTool) as string;
            IRaster outputRaster = GeoprocessingUtility.GetRasterFromPath(resultPath);

            GeoprocessingUtility.ResetGeoprocessor();

            return(outputRaster);
        }
コード例 #4
0
        public static IRaster SnapPourPoint(IGeoDataset seedClass, IGeoDataset flowAccumulation, double snapDistance)
        {
            var geoprocessor = GeoprocessingUtility.GetGeoprocessor();

            var snapPourPointTool = new ESRI.ArcGIS.SpatialAnalystTools.SnapPourPoint();

            snapPourPointTool.in_pour_point_data     = seedClass;
            snapPourPointTool.in_accumulation_raster = flowAccumulation;
            snapPourPointTool.snap_distance          = snapDistance;

            string  resultPath   = GeoprocessingUtility.RunGpTool(geoprocessor, snapPourPointTool) as string;
            IRaster outputRaster = GeoprocessingUtility.GetRasterFromPath(resultPath);

            GeoprocessingUtility.ResetGeoprocessor();

            return(outputRaster);
        }
コード例 #5
0
        private static IRaster _InternalWatershed(IRaster flowDir, object pourPoints, string outputPath)
        {
            var geoprocessor = GeoprocessingUtility.GetGeoprocessor(true, false, true, flowDir);

            var watershedTool = new ESRI.ArcGIS.SpatialAnalystTools.Watershed();

            watershedTool.in_flow_direction_raster = GeoprocessingUtility.GetGPRasterObject(flowDir);
            watershedTool.in_pour_point_data       = pourPoints;
            watershedTool.out_raster = outputPath;

            string  resultPath   = GeoprocessingUtility.RunGpTool(geoprocessor, watershedTool) as string;
            IRaster outputRaster = GeoprocessingUtility.GetRasterFromPath(resultPath);

            GeoprocessingUtility.ResetGeoprocessor();

            return(outputRaster);
        }
コード例 #6
0
        public static IRaster Watershed(IRaster flowDir, IRaster pourPoints, string outputPath)
        {
            var pourPointsObject = GeoprocessingUtility.GetGPRasterObject(pourPoints);

            return(_InternalWatershed(flowDir, pourPointsObject, outputPath));
        }
コード例 #7
0
        public static IRaster Watershed(IRaster flowDir, IFeatureClass pourPoints, string outputPath)
        {
            string pourPointsPath = GeoprocessingUtility.GetFeatureClassPath(pourPoints);

            return(_InternalWatershed(flowDir, pourPoints, outputPath));
        }