private void ContractPolygon(List <string> polylines, string outputFilePath) { var f2p = new FeatureToPolygon { in_features = string.Join(";", polylines.ToArray()), out_feature_class = outputFilePath }; ExecuteProcess(f2p); }
private void ConstructPolygon(string folder, string from, int index, string layerField, string layer) { var select = new Select { in_features = string.Format("{0}\\{1}.shp", folder, from), out_feature_class = string.Format("{0}\\{1}_{2}_1.shp", folder, from, index), where_clause = string.Format("{0} = '{1}'", layerField, layer) }; ExecuteProcess(select); var array = new string[] { string.Format("{0}\\{1}_{2}_1.shp", folder, from, index) }; var f2p = new FeatureToPolygon { in_features = string.Join(";", array), out_feature_class = string.Format("{0}\\{1}_{2}_2.shp", folder, from, index) }; ExecuteProcess(f2p); var sj = new SpatialJoin { target_features = string.Format("{0}\\{1}_{2}_3.shp", folder, from, index), join_features = string.Format("{0}\\{1}_{2}_1.shp", folder, from, index), out_feature_class = string.Format("{0}\\{1}_{2}.shp", folder, from, index), join_operation = "JOIN_ONE_TO_ONE", join_type = "KEEP_ALL", match_option = "INTERSECTS", search_radius = "0 METERS" }; ExecuteProcess(sj); Delete(string.Format("{0}\\{1}_{2}_1.shp", folder, from, index)); Delete(string.Format("{0}\\{1}_{2}_2.shp", folder, from, index)); Delete(string.Format("{0}\\{1}_{2}_3.shp", folder, from, index)); }
private void GPToolStripMenuItem_Click(object sender, EventArgs e) { GPIntsect(); Geoprocessor GP = new Geoprocessor(); GP.OverwriteOutput = true; FeatureToPolygon fpg = new FeatureToPolygon(); ; fpg.in_features = @".\data\数据\regionR.shp"; fpg.out_feature_class = @".\data\数据\FeatureToPolygon2.shp"; GP.Execute(fpg, null); MessageBox.Show("OK"); }