Polygon cropping before doing, in the web search a lot of related posts, the code is similar, but many did not say clearly, in the actual operation of some places need to pay attention to and specifically specified, now some individuals feel the need to pay attention to the place to say:
The core code can be cropped with only the following lines:
Geoprocessor g = new Geoprocessor (); Instantiate a GP object
G.overwriteoutput = true;
Ifeatureclass input = ify. Featureclass;
ESRI. ArcGIS.AnalysisTools.Clip Clip = new ESRI. ArcGIS.AnalysisTools.Clip (input, CLIPFEA, Inpath + "\" + ify. Name + "_clip"); Create Clip cropping tool
[ps:input refers to a layer or shape file that needs to be cropped;
Clipfea refers to the polygon used for cropping, which is generally a shape format file;
Inpath + "\" + ify. The Name + "_clip" parameter is prone to errors, where Inpath refers to the path of the resulting crop output, "\" + ify. Name + "_clip" refers to the file name of the crop result. Inpath must be a full path, such as: "C:\\users\\administrator\\ desktop", if only the path, there is no saved file name, then in the path, the crop result is saved to system.shp, the method will be the result of the crop must be a *. Files in SHP format. ]
G.execute (clip, NULL); Execution tools
If you want to crop the results in the form of Featureclass to the MDB database, you can search the relevant code online, a lot of ready-made code.