1

I'm trying to use the Intersect tool in ArcObjects SDK Java with two feature classes.

Here is my code:

    public void intersectTwoFeatureClasses(Object in1, Object in2, Object out) throws UnknownHostException, IOException {
    IGpValueTableObject intersectInFeatures = new GpValueTableObject();
    intersectInFeatures.setColumns(2);
    intersectInFeatures.setValue(0, 0, in1);
    intersectInFeatures.setValue(0, 1, 1);
    intersectInFeatures.setValue(1, 0, in2);
    intersectInFeatures.setValue(1, 1, 1);
    Intersect intersect = new Intersect(intersectInFeatures, out);
    IGeoProcessorResult result = gp.execute(intersect, null);
    if(result.getStatus() != esriJobStatus.esriJobSucceeded)
        return;
}

But I get an Automation Exception: Item Not Found in this Collection. in 'DAO.Fields'.

The way I create my IGPValueTableObject seems to be wrong.

Does anyone know how to create it for two feature classes ?

  • Have a look at this page, it shows an alternate method for populating the ValueTable. – Hornbydd Mar 26 '14 at 13:13
3

Here is a working and simpler solution I found:

Intersect intersect = new Intersect(in1 + ";" + in2, out);

where in1 , in2 and out are strings giving the full path of input and output is a IFeatureClass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.