i am trying to pass polyline and polygon feature classes i am not sure how to pass the list of features to the Intersect object:

i tried this method:

ArrayList<Object> featuresList = new ArrayList<>();

        FeatureClass polygonfeatureClass = openFeatureClassFromShapeFile(srcShapefilePath, "polygon.shp");
        FeatureClass polylinefeatureClass = openFeatureClassFromShapeFile(srcShapefilePath, "lines.shp");

        Intersect newintersect = new Intersect();

        gp = new GeoProcessor();
        gp.setEnvironmentValue("workspace", srcShapefilePath);


i get this error :

Item not found in this collection. in 'DAO.Fields'

com.esri.arcgis.geoprocessing.GeoProcessor.execute(Unknown Source)

i tried to pass the shape files pathes as string too> i got the same error then i tried this method: after i created 2 feature classes in gdb

String in1=srcShapefilePath + File.separator + "layers.gdb" + File.separator +            "lines";

       String in2=srcShapefilePath + File.separator +  "layers.gdb" + File.separator + "polygon";
       newintersect.setInFeatures(in1 + ";" + in2);
       gp.execute(newintersect, null);

and i got the same error

AutomationException: 0x80004005 - Unspecified error at com.esri.arcgis.geoprocessing.GeoProcessor.execute(Unknown Source) at com.esri.arcgis.geoprocessing.GeoProcessor.execute(Unknown Source)

Any Idea?

1 Answer 1


@mashhour-darweish ,Try the below approach.The code is in C# style. It may be similar in Java too.

  Geoprocessor GP = new Geoprocessor();     
  GP.OverwriteOutput = true;

  Intersect IntersectDataset = new Intersect();
  IntersectDataset.in_features = "(" + srcShapefilePath+"\\polygon.shp", "polygon.shp" + "; " + srcShapefilePath+"\\lines.shp" + ")";
  IntersectDataset.out_feature_class = srcShapefilePath+"\\myoutput.shp";
  IntersectDataset.output_type = "LINE";

  IGeoProcessorResult result;
  result = (IGeoProcessorResult)GP.Execute(process, null);
  • i used the same way in your code @Durga an there is no error: String in = "(" + srcShapefilePath + "\\polygon.shp; " + srcShapefilePath + "\\lines.shp)"; that what java accepts. but what the output.shp , is it an empty shape file which i have created already? Feb 3, 2015 at 17:37
  • Intersection of lines.shp and polygon.shp is stored in output.shp.
    – addcolor
    Feb 4, 2015 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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