1

I try to merge the some shapefiles into one by using ArcEngine java platform. But it seem like that parameters of my merge class is wrong ,i google it a long time and got nothing. Pls figure my problem out .The Error is :Invalid value type for parameter inputs.

public static  IGeoProcessorResult mergeTool(String shpPath,String[] shpNames,  String outFile) 
{  
    //Initialize the geoprocessorResult object
    //IGeoProcessorResult vGeoPR = null;
    // Initialize the geoprocessor.
    GeoProcessor vGeoP = null;
    IGeoProcessorResult vGeoPR = null;
    try {
        vGeoP = new GeoProcessor();
        IWorkspaceFactory vWSpaceFactory =new ShapefileWorkspaceFactory();
        //IFeatureClass vFeaCls = vFeatureWSpace.openFeatureClass(ShapeName);
       IWorkspace vWorkSpace; 
       IFeatureWorkspace vFeatureWSpace = null;
       vWorkSpace = vWSpaceFactory.openFromFile(shpPath, 0);
    vFeatureWSpace = (IFeatureWorkspace)vWorkSpace;
        IFeatureClass vFeaCls = null; 

        ArrayList<IFeatureClass> vInArray = new ArrayList<IFeatureClass>();
        for(int i=0;i<shpNames.length;i++)
        {

            vFeaCls= vFeatureWSpace.openFeatureClass(shpNames[i]);
            vInArray.add(vFeaCls);
        }
        //vGeoP.addMessage("I will overwrite your file if name exits!");
      // vGeoP.setEnvironmentValue("workSpace", vFeatureWSpace);
        vGeoP.setOverwriteOutput(true); 
         Merge  vMerge = new Merge(vInArray,outFile);
            vGeoPR=vGeoP.execute(vMerge,null);
            return vGeoPR;
1

I found out one way to solve this problem.We should set the input parameter format like this:

 String inputString = inputDir1+";"+inputDir2;
           Merge  vMerge = new Merge(inputString ,outFile);

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.