The following code is within a while loop, thanks for investigating! if (blnFirstCounty == true) { // get ref to local_mcd_muni layer if it already exists IFeatureLayer lObjLocalMcdMuniFL = Utilities.FindFeatureLayer(OutputLayerName, lObjMxDoc); if (lObjLocalMcdMuniFL == null) { // LocalMcdMuni layer does not exist, create it using this county WriteToLog(lObjLogFile, "Exporting " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName ); Utilities.ExportFeaturesToShape(lObjFinalLocalMuniFL, OutputLayerName, Utilities.ShapeFileOutputPath, null); // Add the layer to the map WriteToLog(lObjLogFile, "Adding " + lObjFinalLocalMuniFL.getName() + " to the map." ); Utilities.AddShapeFile(OutputLayerName, Utilities.ShapeFileOutputPath, lObjArcApp); //JOptionPane.showMessageDialog(null, "exported " + OutputLayerName); } else { // LocalMcdMuni layer does exist, append this county to it. WriteToLog(lObjLogFile, "Appending " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName); Utilities.GeoProcess(lObjFinalLocalMuniFL.getName().concat(".shp"), OutputLayerName.concat(".shp"), Utilities.ShapeFileOutputPath, "", "", "Append"); } blnFirstCounty = false; } else { // This is not the 1st county, so append it to the master layer WriteToLog(lObjLogFile, "Appending " + lObjFinalLocalMuniFL.getName() + " to " + OutputLayerName); Utilities.GeoProcess(lObjFinalLocalMuniFL.getName().concat(".shp"), OutputLayerName.concat(".shp"), Utilities.ShapeFileOutputPath, "", "", "Append"); } // Clean up temp files / layers Utilities.RemoveLayer(strExplodeLayer, lObjMxDoc); Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, strExplodeLayer); Utilities.RemoveLayer(strMuniMcdIdentiryLayerName, lObjMxDoc); Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, strMuniMcdIdentiryLayerName); Utilities.RemoveLayer(lObjFinalLocalMuniFL.getName(), lObjMxDoc); Utilities.DeleteShapeFile(Utilities.ShapeFileOutputPath, lObjFinalLocalMuniFL.getName()); }
... View more