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– Hornbydd2014年03月26日 13:13:18 +00:00Commented Mar 26, 2014 at 13:13
1 Answer 1
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