class FeatureLayerExporter {

    public void exportFeatures(DataTypeInfo dataType, GeoPackage geopackage, ProgressModel model, CancellableTaskActivity ta)
    {
        GeometryColumns geometryColumns = new GeometryColumns();
        String tableName = StringUtilities.replaceSpecialCharacters(dataType.getDisplayName()).replace('-', '_');

        List<Pair<FeatureColumn, String>> columns = createColumns(dataType);
        List<String> featureTables = geopackage.getFeatureTables();
        if (!featureTables.contains(tableName))
        {
            geometryColumns.setId(new TableColumnKey(tableName, GeoPackageColumns.GEOMETRY_COLUMN));
            geometryColumns.setGeometryType(GeometryType.GEOMETRY);
            geometryColumns.setZ((byte)1);
            geometryColumns.setM((byte)0);

            BoundingBox boundingBox = new BoundingBox();

            List<FeatureColumn> featureColumns = New.list();
            for (Pair<FeatureColumn, String> pair : columns)
            {
                featureColumns.add(pair.getFirstObject());
            }

            geopackage.createFeatureTableWithMetadata(geometryColumns, boundingBox,
                    ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM, featureColumns);
        }

        List<Long> elementIds = myDataElements.getDataElementCacheIds(dataType);
        if (!elementIds.isEmpty())
        {
            try
            {
                FeatureDao dao = geopackage.getFeatureDao(tableName);
                List<DataElement> elements = myDataElements.getDataElements(elementIds, dataType, null, false);
                List<Pair<FeatureColumn, String>> columnNames = New.list();
                for (Pair<FeatureColumn, String> pair : columns)
                {
                    if (!GeoPackageColumns.GEOMETRY_COLUMN.equals(pair.getSecondObject())
                            && !GeoPackageColumns.ID_COLUMN.equals(pair.getSecondObject()))
                    {
                        columnNames.add(pair);
                    }
                }

                for (DataElement element : elements)
                {
                    if (element.getVisualizationState().isVisible())
                    {
                        myRowExporter.exportRow(element, dao, columnNames);
                        model.setCompletedCount(model.getCompletedCount() + 1);

                        if (ta.isCancelled())
                        {
                            break;
                        }
                    }
                }
                System.err.println(model.getCompletedCount());
            }
            catch (DataElementLookupException e)
            {
                LOGGER.error(e, e);
            }
        }
    }

    public  FeatureLayerExporter(DataElementLookupUtils dataElements);

}