Arcengine Call GP tool to realize polygon clip clipping function

Source: Internet
Author: User
Tags mdb database

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.