Beispiel #1
0
        //-------------------------------------------------------------------------
        internal static bool GenerateProfileData(
            string lineFeatureClass,
            string profileSource,
            string outTable,
            IEnumerable <string> messages,
            string outGraphName = null
            )
        {
            Geoprocessor gp = new Geoprocessor();

            StackProfile stackProfile = new StackProfile();


            stackProfile.in_line_features = lineFeatureClass;
            stackProfile.profile_targets  = profileSource;
            stackProfile.out_table        = outTable;
            if (!string.IsNullOrEmpty(outGraphName))
            {
                stackProfile.out_graph = outGraphName;
            }

            GeoProcessorResult gpResult = new GeoProcessorResult();

            gp.SetEnvironmentValue(environmentName, temporaryWorkspace);
            return(RunTool(gp, stackProfile, null, messages));
        }
Beispiel #2
0
        //-------------------------------------------------------------------------

        public static bool GenerateVisibilityData(
            string rasterSource,
            string observerObjectsFeatureClass,
            VisibilityAnalysisTypesEnum analyzeType,
            string outRasterName,
            IEnumerable <string> messages,
            VisibilityCurvatureCorrectionEnum curvatureCorrection = VisibilityCurvatureCorrectionEnum.FLAT_EARTH,
            string outAglRaster = null,
            int innerRadius     = 0,
            int outerRadius     = 0
            )
        {
            Geoprocessor gp = new Geoprocessor();

            Visibility visibility = new Visibility();

            visibility.analysis_type        = analyzeType.ToString().ToUpper();
            visibility.in_raster            = rasterSource;
            visibility.in_observer_features = observerObjectsFeatureClass;
            visibility.out_raster           = outRasterName;
            if (!string.IsNullOrWhiteSpace(outAglRaster))
            {
                visibility.out_agl_raster = outAglRaster;
            }

            visibility.nonvisible_cell_value = NonvisibleCellValue;

            visibility.horizontal_start_angle = VisibilityFieldsEnum.AzimuthB.ToString();
            visibility.horizontal_end_angle   = VisibilityFieldsEnum.AzimuthE.ToString();
            visibility.vertical_lower_angle   = VisibilityFieldsEnum.AnglMinH.ToString();
            visibility.vertical_upper_angle   = VisibilityFieldsEnum.AnglMaxH.ToString();

            if (innerRadius > 0)
            {
                visibility.inner_radius = innerRadius.ToString();
            }
            if (outerRadius > 0)
            {
                visibility.outer_radius = outerRadius.ToString();
            }

            visibility.curvature_correction = curvatureCorrection.ToString();

            GeoProcessorResult gpResult = new GeoProcessorResult();

            gp.SetEnvironmentValue(environmentName, temporaryWorkspace);;

            return(RunTool(gp, visibility, null, messages));
        }
        //将要素类导入要素数据集方法
        public static bool ImportFeatureIntoDS(IFeatureClass pInFeatureClass, string outPath, string name)
        {
            object       sev = null;
            Geoprocessor GP  = new Geoprocessor();

            try
            {
                FeatureClassToFeatureClass featureClassToFeatureClass = new FeatureClassToFeatureClass();
                featureClassToFeatureClass.in_features = pInFeatureClass;
                featureClassToFeatureClass.out_path    = outPath;
                featureClassToFeatureClass.out_name    = name;
                GP.OverwriteOutput = false;
                IGeoProcessorResult pResult = new GeoProcessorResult();
                GP.Execute(featureClassToFeatureClass, null);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(GP.GetMessages(ref sev));
                return(false);
            }
        }